Why tableswitch requires more than constant-time?

http://jroller.com/page/allex?entry=why_tableswitch_requires_more_than
Everyone knows that there is effective implementation of switch like this:
public void switching( int l )
switch( l )
case 0: m0(); break;
case 1: m1(); break;
case 2: m2(); break;
case 3: m3(); break;
case 4: m4(); break;
case 5: m5(); break;
}using indexing in array of offsets. So, switch is better that such ifs:
if( l == 0 ) m0(); else
if( l == 1 ) m1(); else
if( l == 2 ) m2(); else
if( l == 3 ) m3(); else
if( l == 4 ) m4(); else
if( l == 5 ) m5(); elseI'm testing JVM performance and found that such switch requires linear instead of constant time!
Server JVM executes switch exactly the same time as ifs. Client JVM executes switch x1.5 faster,
but execution time depends of a number of cases.
If you're interested, look at my test - I'm wrong or it's really JVM issue?
http://jroller.com/resources/a/allex/SwitchTest.java
http://jroller.com/resources/a/allex/SwitchTest.class - precompiled
http://jroller.com/resources/a/allex/SwitchTest.jad - decompiled with Jasper to be sure tableswitch is used. It is.
I've tried Sun JDK 1.4.2_10 and 1.5.0_06 32-bit on Windows XP x64 AMD Athlon 3800+ 64 x2.

Yes, this is a JVM issue, but it wasn't addressed until recently.
In the Mustang release, the server compiler will generate code for
constant-time execution of switch statements that are of sufficient
size and density. (Offhand, I think at least 16 cases are needed.)
If the switch is not large or dense enough, decision-tree style
code is generated.
You should try a recent Mustang release; I think you will be pleased.
In 5.0, a prototype of this contstant-time code was released on Sparc
only.
On all other 5.0 platforms, and in 1.4.2 and earlier, a decision-tree was
always produced for switch statements.
Mustang client compiler code for switches has not changed.

Similar Messages

  • Since I upgraded to Adobe Created Cloud, my photo editing processes are taking more than 10 times longer than they used to.  Why would this be?

    Since I upgraded to Adobe Created Cloud, my photo editing processes are taking more than 10 times longer than they used to.  Why would this be?

    You will likely get better program help in a program forum
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Why my iphone 4s always experienced simcard failure? sometimes it is about more than 20 times per day

    why my iphone 4s always experienced simcard failure? sometimes it is about more than 20 times per day

    i have done everything. but the phone keep showing INVALID SIM

  • Further to requiring more than 3Gig of Memory

    I thought users would find this interesting and maybe a person familiar canshed some light on this subject.
    I have a 20 minute video with a combo of Pictures/ Sony HDV Video/ Shake and Motion. Producing an IDVD movie works fine however when I try to compress it to "H.264 60 minute default" there is FCP crashing and the compression terminates. In watching the RAM usage I notice a couple of things. First the Page outs are Zero until suddenly after about 6000-8000 frames the page outs grow rapidly and the Green RAM indicator shrink from 2 gigs free to virtually 30-60 megs and the page outs grow to the hunders of thousands. Sometime after this happens the FCP application will crash. Second, I have also noticed that the Compressord shows up from the time I start the process and shows red..."not responding". The Final Cut thread also moves in and out from Not responding. It almost appears as though the Compression processes faster than the computer can handle and then gives up. I Realize I require more than 3 Gigs of Ram but my previous IMAC never crashed doing a similar priocess with 2 Gig or Ram.
    MAC PRO   Mac OS X (10.4.9)   FCP 5.1.4
    MAC PRO   Mac OS X (10.4.7)  

    FCP RAM requirements, and for that matter, those of "Pro" apps, far exceed the memory needed for the likes of iMovie. All of the iLife apps are written in a way as to work across the board on Apples product line. The Pro apps are engineered to operate like they should...... capable of using a ton of memory, and expecting it. When they don't get it, they resort to paging to the hard drive. You may be able to "cripple" FCP by lowering the memory usage in Preferences, but why would you use a program with all that horsepower, and not feed it the memory it needs? If it works in iMovie, I would use it until you can add the appropriate amount of RAM the article hatter posted suggests. Just my two cents....
    Michael

  • Setting up inspection point in a scenario require more than one inspection

    Hi all,
    Maybe I am still not very clear on the PP-QM conceptu2026 hope you can see my problem on the following questionu2026..
    According to SAP in the QM-production environment, we key in ONE inspection point in the task list header level (i.e. either the master recipe, routing, or rate of routing).
    Based on the following business scenario which is going to use inspection point for the inspection:
    u2022     Time-based intervals (for example, an inspection point every hour or for each work shift)
    u2022     Quantity-based intervals (for example, an inspection point for each container)
    u2022     Freely-defined intervals (for example, an inspection point each time a tool change occurs)
    Since each of the above scenarios require more than one inspection points to be created and to be assigned to the task list header.
    Thus, how to accomplish multiple inspection point assignment when the task-list header only allow me to assign one inspection point at a time?
    Thanks
    YY

    Hi guys,
    Thanks. However, in the SAP help portal it does said the system allows several inspection points to be assigned to an inspection operation whether it is in routing or recipe.
    Therefore, does it means I can assign more than one inspection points in the operation detail level for either recipe or routing if I will to click the u201CNo relationu201D radio button in the u201CQuality Management: Inspection Pointu201D section. (i.e. is this is the right place to allows this assignment)?
    For example, on the change master recipe screen at the Operation tab, I highlight one line item (i.e. one operation line item and zoom into this operation line item, I donu2019t see any field box that allow me to assign several inspection points to an operation? Instead, on the u201CQuality Management: Inspection Pointu201D section, there are the following fields appear:
    - Insp.pointCompletion dropdown box
    - 4 radio buttons on the inspection interval (ie. Time-related, Qty-related, No-relation) and its subseq time and quantity value input box.
    - Quan.pt. lot checkbox
    - Last Part Lot Assgmt checkbox
    Thus, where is the section in the operation overview screen at Master Recipe or Routing level that I can assign several inspection points?
    Thanks
    YY

  • Send the email to myself with 4 pictures for more than 100 times --- i didn't do this

    one of my colleages send an email to [email protected], and cc the email to me.
    and my blackberry send the email with 4 pictures in my camera folder to me and joegmail.com for more than 50 times a day.
    Why does it happen? and what should i do for that. please help.

    one of my colleages send an email to [email protected], and cc the email to me.
    and my blackberry send the email with 4 pictures in my camera folder to me and joegmail.com for more than 50 times a day.
    Why does it happen? and what should i do for that. please help.

  • Execute more than one times external command of OS Windows NT

    Hi all,
            I have to execute more than one times from an ABAP program an exernal command of Operating system windows NT . In order to reach this goal I found the standard program RSBDCOS0 and it works very well if you execute it one time.  Unfortunately I have to execute this external command more than one times. Is there any soluiton?
    thank to all
                        Gino Bonfiglioli

    Well why are you using this report RSBDCOS0 to execute external commands?
    Because SAP provides certain function modules that can be used to call operating system commands; so you can use these functions to do your task.
    Just check the following link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fa/0971e1543b11d1898e0000e8322d00/frameset.htm
    As you mentioned that you need to execute multiple times, you can easily put the call to function module inside a loop or do/enddo structure. for example consider the following
    do 3 times.
    call function 'SXPG_COMMAND_EXECUTE'                           
          exporting                                                 
               commandname                   = 'Put operating system command here'          
               additional_parameters         = full_filename        
               targetsystem                  = targtsys  
               stdout                        = 'X'                  
               stderr                        = 'X'                  
               terminationwait               = 'X'                  
          importing                                                 
               status                        = sxpg_status          
               exitcode                      = sxpg_exitcode        
          tables                                                    
               exec_protocol                 = sxpg_results         
          exceptions                                                
               no_permission                 = 1                    
               command_not_found             = 2                    
               parameters_too_long           = 3                    
               security_risk                 = 4                    
               wrong_check_call_interface    = 5                    
               program_start_error           = 6                    
               program_termination_error     = 7                    
               x_error                       = 8                    
               parameter_expected            = 9                    
               too_many_parameters           = 10                   
               illegal_command               = 11                   
               wrong_asynchronous_parameters = 12                   
               cant_enq_tbtco_entry          = 13                   
               jobcount_generation_error     = 14                   
               others                        = 15.                  
    write the results
    loop at sxpg_results.
    write:/ sxpg_results-length,
             sxpg_results-message.
    endloop.
    refresh sxpg_results.
    enddo.

  • How to deploy a Webapplication on WAS more than one times on same server?

    Hi all,
    I 've a special problem:
    In our web-app (some DC's) also stored propertie-Files. Now we would to deploy this application more than one times at same server using different WebContentRoots. (f.e. http://server/app1 and http://server/app2 a.s.o.)
    We know, that we must create different EAR-Projects and refer the web-Module and configure the application.
    But in the second application there it's recommended to change some properties.
    How we can handle this in JDI without copy the web-application?
    I hope my question can be understood.
    Best Regards
    Sven Rickelt
    Using Netweaver + WAS 6.40 2004 SP 13

    Hi Sven,
    as I'm new to NWDI, I cannot give you a 100 percent, field-tested solution. But have you already thought about using the Configuration-Adapter?
    If you can change the source of your web-app, you could maintain the data formerly stored in property files using the configuration adapter of visual administrator. The SC <a href="http://help.sap.com/saphelp_nw04/helpdata/en/45/e7e14b517b42788a1c166f9f32455e/content.htm">configuration</a> allows you to access this data.
    With this approach you can stick to one web-application and do the configuration work separately for each deployed application.
    Best regards,
    Frank

  • How to share more than one Time Machine folder

    Hi,
    With Snow Leo Server I found how to find how to share more than one Time Machine Folder but I can't see how to do the same with Lion Server, could you help me with that ?
    The goal of that is to offer one TM folder per user which is located on a dedicated partition in order to limit the size of TM backups per user (150Gig).
    In Lion, in can only share one TM folder for everybody and I didn'tfind if I can set a limit size per user...
    Thank you in advance,

    I have figured out a way to enable multiple backup targets.
    However, it's one of these things I wouldn't want to describe to anyone except true programmer types, because everyone else has a 90%+ chance of messing up their system if they do something wrong.
    It involves turning off file sharing, and then editing the plist files in /private/var/db/dslocal/nodes/Default/sharepoints/
    The gist of it is this:
    a) first create all the share points you later want to use for TimeMachine, and set them up for afp-only file sharing, also create one TM target, which you can either use later, or have there so the system has one entry it knows how to handle. I just made a bogus one that I'm not actively using.
    b) turn off file sharing in Server.app
    c) turn off TimeMachine in Server.app
    d) now you can edit the files, the easiest is with Xcode, so you may want to install that first
    e) for each sharpoint you made in a) there will be a corresponding .plist file in the location indicated, these are the files that need to be edited.
    f) for each of these files
         1) the item0 string property in the timeMachineBackup array must be switched from 0 to 1
         2) a new key of type array with the name timeMachineBackupUUID must be created
         3) in the newly created array an item of type string must be placed with the value of a UUID, which can be created with the shell command uuidgen
    g) make sure all the edited plist files are saved
    h) turn on TimeMachine in the Server.app again
    If all went well, you now should be able to go to one of your networked client computers and see all the time machine share points just created as options for being a time machine target.
    Anyway, if you go that route: be careful, don't blame me if you muck things up...

  • Not able to load pages more than 3 times continuosly

    Hi
    JDeveloper 11.1.1.6, BPM/SOA 11.1.1.6, WLS 10.3.6, Database : MS SQL Server 2008 R2
    I am not very sure if it is related to BPM or ADF, but it looks more like an ADF error..
    We have a BPM process with some human tasks. The human tasks pages are ADF pages.
    The pages / user tasks are opened properly for a few times, but does not load after that, until we close all the browser windows.
    I am getting these errors intermittently whenever I try to open a human task page in the BPM Workspace.
    (Common observation is that for the first few times the pages open properly. After more than 3+ times of opening the same task repeatedly, I a getting these 2 errors).
    The page stops rendering after the last text '<div' tag.
    Following are the 2 exceptions we see in the logs of the server.
    We are using MS Sql Server 2008 R2 for database.
    I tried with both Type 4 XA and Non XA versions of the JDBC Connections, but still getting the same error messages.
    Can anyone please let us know if we might be missing anything.
    Thanks for any help.
    Sameer
    Exceptions
    ####<Nov 1, 2013 12:32:34 PM EDT> <Info> <JDBC> <localhost> <BPM_MY_server_2> <[ACTIVE] ExecuteThread: '12' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <6e6476ca04c34712:23175e39:14213d8a6b8:-8000-0000000000025615> <1383323554494> <BEA-001128> <Connection for pool "MYDS" has been closed.>
    ####<Nov 1, 2013 12:32:34 PM EDT> <Info> <JDBC> <localhost> <BPM_MY_server_2> <[ACTIVE] ExecuteThread: '12' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <6e6476ca04c34712:23175e39:14213d8a6b8:-8000-0000000000025615> <1383323554497> <BEA-001128> <Connection for pool "MYDS" has been closed.>
    ####<Nov 1, 2013 12:38:37 PM EDT> <Info> <ServletContext-/workflow/MYProcessesUI> <localhost> <BPM_MY_server_2> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <E5OI> <> <6e6476ca04c34712:23175e39:14213d8a6b8:-8000-0000000000025eec> <1383323917256> <BEA-000000> <JspServlet error: Servlet unable to dispatch to the following requested page: The following exception occurred:oracle.jbo.common.ampool.ApplicationPoolException: JBO-30003: Application pool com.dso.publicModel.applicationModule.CostReportInstanceAMLocal fails to check out an application module due to the following exception:>
    ####<Nov 1, 2013 12:38:37 PM EDT> <Error> <HTTP> <localhost> <BPM_MY_server_2> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <6e6476ca04c34712:23175e39:14213d8a6b8:-8000-0000000000025eec> <1383323917268> <BEA-101017> <[ServletContext@1068542008[app:MY module:/workflow/MYProcessesUI path:/workflow/MYProcessesUI spec-version:2.5]] Root cause of ServletException.
    java.lang.IllegalStateException: Attempt to validate an already invalid RegionSite:
                    at oracle.adf.view.rich.component.fragment.UIXRegion$RegionSiteImpl.validate(UIXRegion.java:993)
                    at oracle.adf.view.rich.component.fragment.UIXRegion$RegionContextChange.doChangeImpl(UIXRegion.java:1198)
                    at oracle.adf.view.rich.context.DoableContextChange.doChange(DoableContextChange.java:91)
                    at oracle.adf.view.rich.component.fragment.UIXRegion._beginInterruptibleRegion(UIXRegion.java:693)
                    at oracle.adf.view.rich.component.fragment.UIXRegion.encodeBegin(UIXRegion.java:283)
                    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:929)
                    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:406)
                    at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
                    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:421)
                    at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.renderChildrenAfterHelpAndInfo(PanelHeaderRenderer.java:542)
                    at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer._renderContentCell(PanelHeaderRenderer.java:1067)
                    at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.renderContentRow(PanelHeaderRenderer.java:490)
                    at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.encodeAll(PanelHeaderRenderer.java:231)
                    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
                    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
                    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
                    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:938)
    And
    [2013-11-01T12:17:08.807-04:00] [BPM_MY_server_2] [NOTIFICATION] [J2EE JSP-00008] [oracle.j2ee.jsp] [tid: [ACTIVE].ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: sdarbha] [ecid: 6e6476ca04c34712:23175e39:14213d8a6b8:-8000-0000000000023fb4,0] [APP: MY] unable to dispatch JSP page: The following exception occurred:.[[
    JBO-30003: Application pool com.dso.publicModel.applicationModule.CostReportInstanceAMLocal fails to check out an application module due to the following exception:
    java.lang.ClassCastException: weblogic.jdbc.wrapper.PoolConnection_weblogic_jdbc_sqlserverbase_ddah
                    at oracle.jbo.server.OracleSQLBuilderImpl.setSessionTimeZone(OracleSQLBuilderImpl.java:5533)
                    at oracle.jbo.server.DBTransactionImpl.refreshConnectionMetadata(DBTransactionImpl.java:5311)

    Hi,
    depends on whether you control the BPM task flow or not. If you do, have a look at this thread for how to debug the problem
    How to debug "Attempt to validate an already invalid RegionSite"?
    Otherwise, post it to the SOA forum if this is initiated by their generated code. The most common reason though is that the task flow lacks a default activity. So if the default activity is somewhat calculated dynamically in your application then this may be a reason
    Frank

  • ReturnEvent not get called after search more than 10 times in LOV page

    hi there,
    I using ADF and Jdeveloper 10.3.1.2
    In my project I have a form which called a LOV page for selecting multiple records and submit button sumup the values of each selected row of LOV and return to the main form and display added value on text field.
    problem is when I search records more than 10 times or more I put search criteria and select row on each time. After click on submit the value of each row is sum up return on the main form but it not reflected on main form because ReturnListener not get called .
    But when I select many rows more than 10 without searching then the ReturnListener get called when it returning on main form.
    So should I do so that ReturnListener get called.
    Is it any bug of ADF or Jedeveloper .

    Hi,
    depends on whether you control the BPM task flow or not. If you do, have a look at this thread for how to debug the problem
    How to debug "Attempt to validate an already invalid RegionSite"?
    Otherwise, post it to the SOA forum if this is initiated by their generated code. The most common reason though is that the task flow lacks a default activity. So if the default activity is somewhat calculated dynamically in your application then this may be a reason
    Frank

  • I have a problem with iPhone is that I can replace it at points of sale in the U.S. because I bought from Saudi Arabia because the problem I think in the hard ware software worked more than 3 times did not fix

    dears,
    I have a problem with iPhone is that I can replace it at points of sale in the U.S. because I bought from Saudi Arabia because the problem I think in the hard ware I do resoftware more than 3 times did not fix.
    Network also always missing.
    I am living in KS Wichita. I hope you help me pleas.
    Regards.

    iPhone warranty is not international. You will have to return your
    iPhone to Saudi Arabia for repair/replacement. Either take it back
    yourself or send to friend/relative for them to take to Apple. Apple
    will not accept international shipments for repair nor will Apple
    ship repaired/replaced iPhones out of the country where the repair
    was done.

  • Updating from 5.0 to 6.0, it keeps asking me to reboot windows to finish updating process, I have tried to reboot more than 5 times, still keep asking... Even click to uninstall, still ask me to reboot windows to finish updating process...Any help?

    updating from 5.0 to 6.0, it keeps asking me to reboot windows to finish updating process, I have tried to reboot more than 5 times, still keep asking... Even click to uninstall, still ask me to reboot windows to finish updating process...Any help?

    updating from 5.0 to 6.0, it keeps asking me to reboot windows to finish updating process, I have tried to reboot more than 5 times, still keep asking... Even click to uninstall, still ask me to reboot windows to finish updating process...Any help?

  • Is possible to execute the same executable vi more than 1 time (like notepad, for example)?

    I have a Labview executable file that use serial ports to communicate with other devices. I need to execute the same "file.exe" more than 1 time, to control different devices simultaneously. When I double click on an executable been executed (from windows explorer), the file under execution comes to front. Is possible to execute the same file more than 1 time (like notepad, for example)?

    Not the answer you are looking for I know..but still: Copying the application to another location is one possibility...if it has a different path it will execute separately.
    (OR - build control of multiple devices into one and the same application... If you do not want to redesign the code to handle multiple instruments in the same VIs, you could clone the VIs within the same application...)
    MTO

  • Can we prevent entering the same condition more than one time?

    Hi friends,
    Can we prevent the user for entering the same condition type more than one time in same sales order?
    Rama rao

    /write codes in Include ZXVVAU05/
    /prgm avbl in one of the msg in forum/
    DATA: BEGIN OF tXKOMV OCCURS 50.
    INCLUDE STRUCTURE KOMV.
    DATA: END OF tXKOMV.
    data : tab_name(40) type c ,
    ld_len type i , ld_len1 type i .
    field-symbols : <tab> type any.
    tab_name = '(SAPMV45A)XKOMV[]'.
    assign (tab_name) to <tab>.
    txkomv[] = <tab>.
    describe table txkomv lines ld_len .
    sort txkomv by kposn KSCHL .
    delete adjacent duplicates from txkomv comparing kposn KSCHL .
    describe table txkomv lines ld_len1 .
    if ld_len1 ne ld_len .
    refresh txkomv .
    message e002(zmm) with ' Please remove duplicate condition in item price' .
    endif .

Maybe you are looking for