Simple performance question

Simple performance question. the simplest way possible, assume
I have a int[][][][][] matrix, and a boolean add. The array is several dimensions long.
When add is true, I must add a constant value to each element in the array.
When add is false, I must subtract a constant value to each element in the array.
Assume this is very hot code, i.e. it is called very often. How expensive is the condition checking? I present the two scenarios.
private void process(){
for (int i=0;i<dimension1;i++)
for (int ii=0;ii<dimension1;ii++)
  for (int iii=0;iii<dimension1;iii++)
    for (int iiii=0;iiii<dimension1;iiii++)
         if (add)
         matrix[i][ii][iii][...]  += constant;
         else
         matrix[i][ii][iii][...]  -= constant;
private void process(){
  if (add)
for (int i=0;i<dimension1;i++)
for (int ii=0;ii<dimension1;ii++)
  for (int iii=0;iii<dimension1;iii++)
    for (int iiii=0;iiii<dimension1;iiii++)
         matrix[i][ii][iii][...]  += constant;
else
for (int i=0;i<dimension1;i++)
for (int ii=0;ii<dimension1;ii++)
  for (int iii=0;iii<dimension1;iii++)
    for (int iiii=0;iiii<dimension1;iiii++)
       matrix[i][ii][iii][...]  -= constant;
}Is the second scenario worth a significant performance boost? Without understanding how the compilers generates executable code, it seems that in the first case, n^d conditions are checked, whereas in the second, only 1. It is however, less elegant, but I am willing to do it for a significant improvement.

erjoalgo wrote:
I guess my real question is, will the compiler optimize the condition check out when it realizes the boolean value will not change through these iterations, and if it does not, is it worth doing that micro optimization?Almost certainly not; the main reason being that
matrix[i][ii][iii][...]  +/-= constantis liable to take many times longer than the condition check, and you can't avoid it. That said, Mel's suggestion is probably the best.
but I will follow amickr advice and not worry about it.Good idea. Saves you getting flamed with all the quotes about premature optimization.
Winston

Similar Messages

  • 4 Simple Flash Questions that Are Stumping Me!

    What is the Frame Rate for Web Animations
    Q1. I am making an animation which will be played on the web. What is the default frame rate (fps) of Flash CS5? And what is the frame rate of for web?
    Q2. My animation needs to be 30 seconds long. So at 15 fps that would mean I need to use 600 frames in Flash?
    How Do I Mask everything so all I see is the Content on the Stage?
    I have a wide image that extends past my movies stage size so when I preview my movie the image is visible. How do I mask out anything that extends past my movies window size? I believe I can create a layer named "mask" and place it above all other layers, but I forget how to make the mask. Any help is appreciated.
    How to Fade a Graphic
    I have a graphic element (some type) and I want it to fade from 0% to 100%. In older versions of Flash I could just select the symbol and then set it's alpha value to 0%, move a few keyframes and then set the alpha to 100%. Voila! but now it doesn't seem to work that way. How can I do this in CS5?

    Ned, it says 24 fps which means there is 24 frames per second so each 24 frames is 1 second.
    Date: Fri, 4 Nov 2011 05:35:16 -0600
    From: [email protected]
    To: [email protected]
    Subject: 4 Simple Flash Questions that Are Stumping Me!
        Re: 4 Simple Flash Questions that Are Stumping Me!
        created by Ned Murphy in Flash Pro - General - View the full discussion
    1 You can create your character as a movieclip and copy/paste that movieclip from one file to another. 2. One way to create a movieclip is to copy all the frame of the animation's timeline (select them all, right click the selection, choose Copy Frames), then create a new movieclip symbol (Insert -> New Symbol...etc) right click on its only keyframe and chhose Paste Frames.  THat will put all the layers and frames you copied into the movieclip The only way to come close to being certain about the timing of you animation is to use code to keep track of the time, something like getTimer()..  The frame rate that a file plays at is not a reliable means of dictating the time it takes due to a variety of factors which include the amount of content you are trying to process and performance limits of the user's machine.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4007420#4007420
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4007420#4007420. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Flash Pro - General by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Just a suggestion..........
    Download Thunderbird.  Easier to use when it comes to what you want to do w/your emails. 

  • BPM performance question

    Guys,
    I do understand that ccPBM is very resource hungry but what I was wondering is this:
    Once you use BPM, does an extra step decreases the performance significantly? Or does it just need slightly more resources?
    More specifically we have quite complex mapping in 2 BPM steps. Combining them would make the mapping less clear but would it worth doing so from the performance point of view?
    Your opinion is appreciated.
    Thanks a lot,
    Viktor Varga

    Hi,
    In SXMB_ADM you can set the time out higher for the sync processing.
    Go to Integration Processing in SXMB_ADM and add parameter SA_COMM CHECK_FOR_ASYNC_RESPONSE_TIMEOUT to 120 (seconds). You can also increase the number of parallel processes if you have more waiting now. SA_COMM CHECK_FOR_MAX_SYNC_CALLS from 20 to XX. All depends on your hardware but this helped me from the standard 60 seconds to go to may be 70 in some cases.
    Make sure that your calling system does not have a timeout below that you set in XI otherwise yours will go on and finish and your partner may end up sending it twice
    when you go for BPM the whole workflow
    has to come into action so for example
    when your mapping last < 1 sec without bpm
    if you do it in a BPM the transformation step
    can last 2 seconds + one second mapping...
    (that's just an example)
    so the workflow gives you many design possibilities
    (brigde, error handling) but it can
    slow down the process and if you have
    thousands of messages the preformance
    can be much worse than having the same without BPM
    see below links
    http://help.sap.com/bp_bpmv130/Documentation/Operation/TuningGuide.pdf
    http://help.sap.com/saphelp_nw04/helpdata/en/43/d92e428819da2ce10000000a1550b0/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/sap%20exchange%20infrastructure%20tuning%20guide%20xi%203.0.pdf
    BPM Performance tuning
    BPM Performance issue
    BPM performance question
    BPM performance- data aggregation persistance
    Regards
    Chilla..

  • A few simple Logic questions...please help.

    I have a few probably simple Logic questions, that are nonetheless frustrating me, wondering if someone could help me out.
    1. I run Logic 8, all of the sounds that came with logic seem to work except organ sounds. I can't trigger any organ sounds (MIDI) on Logic, they won't play. I have a Yamaha Motif as my midi controller.
    Any idea why?
    2. I've starting running into a situation where I will record a MIDI track, the notes are recorded but they won't playback. The only track effected is the one that was just recorded. All other midi tracks playback.
    I have to cut the track, usually go out of Logic and back in, re record for it to playback properly. Any idea why this may be happening?
    3. How important is it to update to Logic 9. Are there any disadvantages down the road if I don't upgrade. If I purchase the $200 upgrade, do I get a package of discs and material, or it just a web download.
    Any help is appreciated!
    Colin

    seeren wrote:
    Data Stream Studio wrote:
    3) You get a full set of disks and manuals.
    They're including manuals now?
    I think his referring to the booklets ...on how to install etc
    It would be great to see printed manuals though ...I love books especially Logic/Audio related !!
    A

  • Swing performance question: CPU-bound

    Hi,
    I've posted a Swing performance question to the java.net performance forum. Since it is a Swing performance question, I thought readers of this forum might also be interested.
    Swing CPU-bound in sun.awt.windows.WToolkit.eventLoop
    http://forums.java.net/jive/thread.jspa?threadID=1636&tstart=0
    Thanks,
    Curt

    You obviously don't understand the results, and the first reply to your posting on java.net clearly explains what you missed.
    The event queue is using Thread.wait to sleep until it gets some more events to dispatch. You have incorrectly diagnosed the sleep waiting as your performance bottleneck.

  • Xcontrol: performance question (again)

    Hello,
    I've got a little performance question regarding xcontrols. I observed rather high cpu-load when using xcontrols. To investigate it further, I built a minimal xcontrol (boolean type) which only writes the received boolean-value to a display-element in it's facade (see attached example). When I use this xcontrol in a test-vi and write to it with a rate of 1000 booleans / second, I get a cpu-load of about 10%. When I write directly to a boolean display element instead of the xcontrol,I have a load of 0 to 1 %. The funny thing is, when I emulate the xcontrol functionality with a subvi, a subpanel and a queue (see example), I only have 0 to 1% cpu-load, too.
    Is there a way to reduce the cpu-load when using xcontrols? 
    If there isn't and if this is not a problem with my installation but a known issue, I think this would be a potential point for NI to fix in a future update of LV.
    Regards,
    soranito
    Message Edited by soranito on 04-04-2010 08:16 PM
    Message Edited by soranito on 04-04-2010 08:18 PM
    Attachments:
    XControl_performance_test.zip ‏60 KB

    soranito wrote:
    Hello,
    I've got a little performance question regarding xcontrols. I observed rather high cpu-load when using xcontrols. To investigate it further, I built a minimal xcontrol (boolean type) which only writes the received boolean-value to a display-element in it's facade (see attached example). When I use this xcontrol in a test-vi and write to it with a rate of 1000 booleans / second, I get a cpu-load of about 10%. When I write directly to a boolean display element instead of the xcontrol,I have a load of 0 to 1 %. The funny thing is, when I emulate the xcontrol functionality with a subvi, a subpanel and a queue (see example), I only have 0 to 1% cpu-load, too.
    Okay, I think I understand question  now.  You want to know why an equivalent xcontrol boolean consumes 10x more CPU resource than the LV base package boolean?
    Okay, try opening the project I replied yesterday.  I don't have access to LV at my desk so let's try this. Open up your xcontrol facade.vi.  Notice how I separated up your data event into two events?  Go the data change vi event, when looping back the action, set the isDataChanged (part of the data change cluster) to FALSE.  While the data input (the one displayed on your facade.vi front panel), set that isDataChanged to TRUE.  This is will limit the number of times facade will be looping.  It will not drop your CPU down from 10% to 0% but it should drop a little, just enough to give you a short term solution.  If that doesn't work, just play around with the loopback statement.  I can't remember the exact method.
    Yeah, I agree xcontrol shouldn't be overconsuming system resource.  I think xcontrol is still in its primitive form and I'm not sure if NI is planning on investing more times to bug fix or even enhance it.  Imo, I don't think xcontrol is quite ready for primetime yet.   Just too many issues that need improvement.
    Message Edited by lavalava on 04-06-2010 03:34 PM

  • Simple Quick Question

    wrong section, post was moved.
    Message was edited by:
    Rob17

    you titled "simple quick question"...
    .. complicated to answer..
    a) the TermsOfUse of the iTS don't allow any processing of purchased files, these are "copy protected"..
    b) iM has a voice-over function..
    c) iM is a video-edit app.. easy to use... just learn to handle it...
    d) iM allows to "extract" audio (=muting the original audio, adding your own..)
    e) to learn iM, spend some time here: http://www.apple.com/ilife/tutorials/imovie/index.html
    f) use pencil and paper first! WRITE and scribble, what shall happen when in your movie/parody... make a script, draw a storyboard .. THEN launch iM.. in other words: think first, then edit.. iM is just a tool, it does not "create"... Picasso needed a papertowel and half a stencil to create art....
    g) to get comfortable with iM, start with your own, small, short (3min!) project... import some stills, edit them, add a funny voice-over, add sounds, add music... good? make a bigger one...
    h) .. in our Lecture II, we teach you how to import shows from TV, youtube, wherever..
    standard disclaimer:
    be nice to ©opyrights ...

  • Simple performance verification

    I wish to do a simple performance verification on 6035E and 6034E cards as follows: Input a 2Vpp 1kHz square wave into each analog input on the BNC-2110. Can anyone tell me what tolerances I might allow when viewing the results on the monitor using the scope function?
    Thank you,
    Jim

    Hello Jared, and thank you for replying.
    The VIs that we use in the scope program to make measurements are:
    AI Acquire Waveform.vi
    Amplitude and Levels.vi
    Extract Single Tone.vi
    We have also selected a +5 to -5 Volt range.
    I must admit to being confused by NI's published specs on these boards, that is why I am hoping to have a more familiar spec like 2Vpp +/- xx and 1 kHz +/- xx.
    Thank you again,
    Jim
    Hello,
    I am unfamiliar with Scope function that you mentioned. Maybe if you could shine a little more light on this I might be able to better help.
    When you say tolerance of a measurement, I'm going to think you are looking to find some specifications for your device. You can find some of the published accuracy numbers accuracy for your devices in the E Series User Help file.
    If I'm totally missing on what you really want to know, post back and I'll have a look.

  • Simple query question

    hi all,
    I have a XMLType table with one column - I have presently one row, in my column xmlsitedata I have stored one large xml file.The schema definition is given below:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    - <xs:element name="siteList">
    - <xs:complexType>
    - <xs:sequence>
    <xs:element name="site" type="siteType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    - <xs:complexType name="siteType">
    - <xs:sequence>
    <xs:element name="nameEn" type="xs:string" />
    <xs:element name="nameFr" type="xs:string" />
    </xs:sequence>
    <xs:attribute name="code" type="xs:string" />
    </xs:complexType>
    </xs:schema>
    I have executed the query below:
    select x.XMLSITEDATA.extract('/siteList/site/nameEn/text()').getCLOBVal() "stName" from wsitelist x;
    and I get all english names of some 200 locations, however, there is 1 row selected and all names show up on one row. How do I split them into 200 or whatever rows?
    Thanks,
    Kowalsky

    Have a look at the answer provided in the following thread.
    very simple XML question
    This may solve your problem.
    use xmlsequence.
    Alvinder

  • Simple game performance question

    Hi all!
    Today I installed a simple Mah Jong game on my mothers Mac mini Core 2 Duo 1.83 GHz. The CPU performance should be roughly the same as on my iMac(as specified below). She uses a VGA display and has 1GB of RAM and this game doesn´t require very much RAM. How important is the graphics adapter for the performance of this very simple game with very little 3D effects as compared to the latest games on a pc? Do I get a speed boost because of 256 MB instead of 128 MB VRAM? Is it just Intel GMA 950 to blame for less performance or has it something to do with the VGA display?
    I´m very curious about this. Thanks for your replies.

    +is it just Intel GMA 950 to blame for less performance+
    Probably. Integrated graphics can't match a dedicated graphics card.
    Another possible contributor would be if the Mini with 1 Gig of RAM has a significant number of other memory-consuming programs running at the same time. This would be especially true if any of the programs invoke Rosetta emulation.
    The 2 gig of RAM in the iMac would be a real advantage if it reduces virtual memory activity vis-a-vis the Mini with 1 Gig.
    A fair test would be to make sure no other programs or widgets are running, and then test the game.

  • Oracle: Please implement simple performance improvement in JDBC (Thin) Driver

    Oracle should put dynamic prefetch into their (thin) JDBC driver. I don't use the OCI driver so I don't know how this applies.
    Some of you may be aware that tweaking a statement's row prefetch size can improve performance quite a lot. IIRC, the default prefetch is about 30 and that's pretty useless for queries returning large (# of rows) resultsets, but it's pretty good for queries returning only a small number of records. Just as an example, when running a simple SELECT * FROM foo WHERE ROWNUM <= somenumber query, here's what I got:
    Prefetch = 1: 10000 rows = 15 secs, 1000 rows = 1.5 secs, 10 rows = 30 ms
    Prefetch = 500: 10000 rows = 2.5 secs, 1000 rows = 280 ms, 10 rows = 80 ms
    Prefetch = 2000: 10000 rows = 2 secs, 1000 rows = 700 ms, 10 rows = 460 ms
    From our experience, the default of 30 (?) is too low for most applications, 500 to 1000 would be a better default. In the end, though, the only way to get best performance is to adjust the prefetch size to the expected number of rows for every query. While that sounds like a reasonable effort for developers of a simple client/server application, in a 3-tier system that deals with connection pools in an application server, this just won't work, so here's my suggestion on how Oracle should address this:
    Instead of having just a single prefetch setting for the statement (or connection), there should be an 'initial' prefetch value (with a default of somewhere between 1 and 50) and a maximum prefetch value (with a default of somewhere between 500 and 5000). When the driver pulls the first batch of records from the server it should use the initial refresh. If there are more records to fetch, it should fetch them using the maximum prefetch. This would allow the driver to perform much better for small AND large resultsets while, at the same time, making it transparent to the application (and application developer).
    [email protected]

    I have exactly the same problem, I tried to find out what is going on, changed several JDBC Drivers on AIX, but no hope, I also have ran the process on my laptop which produced a better and faster performance.
    Therefore I made a special solution ( not practical) by creating flat files and defining the data as an external table, the oracle will read the data in those files as they were data inside a table, this gave me very fast insertion into the database, but still I am looking for an answer for your question here. Using Oracle on AIX machine is a normal business process followed by a lot of companies and there must be a solution for this.

  • STATSPACK Performance Question / Discrepancy

    I'm trying to troubleshoot a performance issue and I'm having trouble interpreting the STATSPACK report. It seems like the STATSPACK report is missing information that I expect to be there. I'll explain below.
    Header
    STATSPACK report for
    Database    DB Id    Instance     Inst Num  Startup Time   Release     RAC
    ~~~~~~~~ ----------- ------------ -------- --------------- ----------- ---
              2636235846 testdb              1 30-Jan-11 16:10 11.2.0.2.0  NO
    Host Name             Platform                CPUs Cores Sockets   Memory (G)
    ~~~~ ---------------- ---------------------- ----- ----- ------- ------------
         TEST             Microsoft Windows IA (     4     2       0          3.4
    Snapshot       Snap Id     Snap Time      Sessions Curs/Sess Comment
    ~~~~~~~~    ---------- ------------------ -------- --------- ------------------
    Begin Snap:       3427 01-Feb-11 06:40:00       65       4.4
      End Snap:       3428 01-Feb-11 07:00:00       66       4.1
       Elapsed:      20.00 (mins) Av Act Sess:       7.3
       DB time:     146.39 (mins)      DB CPU:       8.27 (mins)
    Cache Sizes            Begin        End
    ~~~~~~~~~~~       ---------- ----------
        Buffer Cache:       192M       176M   Std Block Size:         8K
         Shared Pool:       396M       412M       Log Buffer:    10,848K
    Load Profile              Per Second    Per Transaction    Per Exec    Per Call
    ~~~~~~~~~~~~      ------------------  ----------------- ----------- -----------
          DB time(s):                7.3                2.0        0.06        0.04
           DB CPU(s):                0.4                0.1        0.00        0.00
           Redo size:            6,366.0            1,722.1
       Logical reads:            1,114.6              301.5
       Block changes:               35.8                9.7
      Physical reads:               44.9               12.1
    Physical writes:                1.5                0.4
          User calls:              192.2               52.0
              Parses:              101.5               27.5
         Hard parses:                3.6                1.0
    W/A MB processed:                0.1                0.0
              Logons:                0.1                0.0
            Executes:              115.1               31.1
           Rollbacks:                0.0                0.0
        Transactions:                3.7As you can see a significant amount of time was spent in database calls (DB Time) with relatively little time on CPU (DB CPU). Initially that made me think there were some significant wait events.
    Top 5 Timed Events                                                    Avg %Total
    ~~~~~~~~~~~~~~~~~~                                                   wait   Call
    Event                                            Waits    Time (s)   (ms)   Time
    log file sequential read                        48,166         681     14    7.9
    CPU time                                                       484           5.6
    db file sequential read                         35,357         205      6    2.4
    control file sequential read                    50,747          23      0     .3
    Disk file operations I/O                        16,518          18      1     .2
              -------------------------------------------------------------However, looking at the Top 5 Timed Events I don't see anything out of the ordinary given my normal operations. the log file sequential read may be a little slow but it doesn't make up a significant portion of the execution time.
    Based on an Excel/VB spreadsheet I wrote, which converts STATSPACK data to graphical form, I suspected that there was a wait event not listed here. So I decided to query the data directly. Here is the query and result.
    SQL> SELECT wait_class
      2       , event
      3       , delta/POWER(10,6) AS delta_sec
      4  FROM
      5  (
      6          SELECT syev.snap_id
      7               , evna.wait_class
      8               , syev.event
      9               , syev.time_waited_micro
    10               , syev.time_waited_micro - LAG(syev.time_waited_micro) OVER (PARTITION BY syev.event ORDER BY syev.snap_id) AS delta
    11          FROM   perfstat.stats$system_event syev
    12          JOIN   v$event_name                evna  ON  evna.name     = syev.event
    13          WHERE  syev.snap_id IN (3427,3428)
    14  )
    15  WHERE delta > 0
    16  ORDER BY delta DESC
    17  ;
    ?WAIT_CLASS               EVENT                                                                        DELTA_SEC
    Idle                      SQL*Net message from client                                                  21169.742
    Idle                      rdbms ipc message                                                            19708.390
    Application               enq: TM - contention                                                       7199.819
    Idle                      Space Manager: slave idle wait                                             3001.719
    Idle                      DIAG idle wait                                                             2382.943
    Idle                      jobq slave wait                                                            1258.829
    Idle                      smon timer                                                                 1220.902
    Idle                      Streams AQ: qmn coordinator idle wait                                      1204.648
    Idle                      Streams AQ: qmn slave idle wait                                            1204.637
    Idle                      pmon timer                                                                 1197.898
    Idle                      Streams AQ: waiting for messages in the queue                              1197.484
    Idle                      Streams AQ: waiting for time management or cleanup tasks                    791.803
    System I/O                log file sequential read                                                    681.444
    User I/O                  db file sequential read                                                     204.721
    System I/O                control file sequential read                                                 23.168
    User I/O                  Disk file operations I/O                                                     17.737
    User I/O                  db file parallel read                                                        14.536
    System I/O                log file parallel write                                                       7.618
    Commit                    log file sync                                                                 7.150
    User I/O                  db file scattered read                                                        3.488
    Idle                      SGA: MMAN sleep for component shrink                                          2.461
    User I/O                  direct path read                                                              1.621
    Other                     process diagnostic dump                                                       1.418
    ... snip ...So based on the above it looks like there was a significant amount of time spent in enq: TM - contention
    Question 1
    Why does this wait event not show up in the Top 5 Timed Events section? Note that this wait event is also not listed in any of the other wait events sections either.
    Moving on, I decided to look at the Time Model Statistics
    Time Model System Stats  DB/Inst: testdb  /testdb    Snaps: 3427-3428
    -> Ordered by % of DB time desc, Statistic name
    Statistic                                       Time (s) % DB time
    sql execute elapsed time                         8,731.0      99.4
    PL/SQL execution elapsed time                    1,201.1      13.7
    DB CPU                                             496.3       5.7
    parse time elapsed                                  26.4        .3
    hard parse elapsed time                             21.1        .2
    PL/SQL compilation elapsed time                      2.8        .0
    connection management call elapsed                   0.6        .0
    hard parse (bind mismatch) elapsed                   0.5        .0
    hard parse (sharing criteria) elaps                  0.5        .0
    failed parse elapsed time                            0.0        .0
    repeated bind elapsed time                           0.0        .0
    sequence load elapsed time                           0.0        .0
    DB time                                          8,783.2
    background elapsed time                             87.1
    background cpu time                                  2.4Great, so it looks like I spent >99% of DB Time in SQL calls. I decided to scroll to the SQL ordered by Elapsed time section. The header information surprised me.
    SQL ordered by Elapsed time for DB: testdb    Instance: testdb    Snaps: 3427 -3
    -> Total DB Time (s):           8,783
    -> Captured SQL accounts for    4.1% of Total DB Time
    -> SQL reported below exceeded  1.0% of Total DB TimeIf I'm spending > 99% of my time in SQL, I would have expected the captured % to be higher.
    Question 2
    Am I correct in assuming that a long running SQL that started before the first snap and is still running at the end of the second snap would not display in this section?
    Question 3
    Would that answer my wait event question above? Ala, are wait events not reported until the action that is waiting (execution of a SQL statement for example) is complete?
    So I looked a few snaps past what I have posted here. I still haven't determined why the enq: TM - contention wait is not displayed anywhere in the STATSPACK reports. I did end up finding an interesting PL/SQL block that may have been causing the issues. Here is the SQL ordered by Elapsed time for a snapshot that was taken an hour after the one I posted.
    SQL ordered by Elapsed time for DB: testdb    Instance: testdb    Snaps: 3431 -3
    -> Total DB Time (s):           1,088
    -> Captured SQL accounts for ######% of Total DB Time
    -> SQL reported below exceeded  1.0% of Total DB Time
      Elapsed                Elap per            CPU                        Old
      Time (s)   Executions  Exec (s)  %Total   Time (s)  Physical Reads Hash Value
      26492.65           29     913.54 ######    1539.34             480 1013630726
    Module: OEM.CacheModeWaitPool
    BEGIN EMDW_LOG.set_context(MGMT_JOB_ENGINE.MODULE_NAME, :1); BEG
    IN MGMT_JOB_ENGINE.process_wait_step(:2);END; EMDW_LOG.set_conte
    xt; END;I'm still not sure if this is the problem child or not.
    I just wanted to post this to get your thoughts on how I correctly/incorrectly attacked this problem and to see if you can fill in any gaps in my understanding.
    Thanks!

    Centinul wrote:
    I'm still not sure if this is the problem child or not.
    I just wanted to post this to get your thoughts on how I correctly/incorrectly attacked this problem and to see if you can fill in any gaps in my understanding.
    I think you've attacked the problem well.
    It has prompted me to take a little look at what's going on, running 11.1.0.6 in my case, and something IS broken.
    The key predicate in statspack for reporting top 5 is:
                      and e.total_waits         > nvl(b.total_waits,0)In other words, an event gets reported if total_waits increased across the period.
    So I've been taking snapshots of v$system_event and looking at 10046 trace files at level 8. The basic test was as simple as:
    <ul>
    Session 1: lock table t1 in exclusive mode
    Session 2: lock table t1 in exclusive mode
    </ul>
    About three seconds after session 2 started to wait, v$system_event incremented total_waits (for the "enq: TM - contention" event). When I committed in session 1 the total_waits figure did not change.
    Now do this after waiting across a snapshot:
    We start to wait, after three seconds we record a wait, a few minutes later perfstat takes a snapshot.
    30 minutes later "session 1" commits and our wait ends, but we do not increment total_waits, but we record 30+ minutes wait time.
    30 minutes later perfstat takes another snapshot
    The total_waits has not changed between the start and end snapshot even though we have added 30 minutes to the "enq: TM - contention" in the interim.
    The statspack report loses our 30 minutes from the Top N.
    It's a bug - raise an SR.
    Edit: The AWR will have the same problem, of course.
    Regards
    Jonathan Lewis
    Edited by: Jonathan Lewis on Feb 1, 2011 7:07 PM

  • Copying arrays, performance questions

    Hello there
    The JDK offers several ways to copy arrays so I ran some experiments to try and find out which would be the fastest.
    I was measuring the time it takes to copy large arrays of integers. I wrote a program that allocates arrays of various sizes, and copy them several times using different methods. Then I measured the time each method took using the NetBeans profiler and calculated the frequencies.
    Here are the results I obtained (click for full size):  http://i.share.pho.to/dc40172a_l.png
    (what I call in-place copy is just iterating through the array with a for loop and copying the values one by one)
    I generated a graph from those values:  http://i.share.pho.to/049e0f73_l.png
    A zoom on the interesting part: http://i.share.pho.to/a9e9a6a4_l.png
    According to these results, clone() becomes faster at some point (not sure why). I've re-ran these experiments a few times and it seems to always happen somewhere between 725 and 750.
    Now here are my questions:
    - Is what I did a valid and reliable way to test performances, or are my results completely irrelevant? And if it's not, what would be a smarter way to do this?
    - Will clone be faster than arraycopy past 750 items on any PC or will these results be influences by other factors?
    - Is there a way to write a method that would copy the array with optimal performances using clone and arraycopy, such that the cost of using it would be insignificant compared to systematically using one method over the other?
    - Any idea why clone() can become faster for bigger arrays? I know arraycopy is a native method, I didn't try to look into what it does exactly but I can't imagine it's doing anything more complicating than copying elements from one location in the memory to another... How can another method be faster than that?
    (just reminding I'm copying primitives, not objects)
    Thanks!
    Message was edited by: xStardust! Added links, mr forum decided to take away my images

    yeh, everyone thinks that at some point. it relies,
    however, on you being perfect and knowing everything
    in advance, which you aren't, and don't (no offence,
    the same applies to all of us!). time and time again,
    people do this up-front and discover that what they
    thought would be a bottleneck, isn't. plus,
    the JVM is much smarter at optimizing code than you
    think: trust it. the best way to get good performance
    out of your code is to write simple, straightforward
    good OO code. JVMs are at a point now where they can
    optimize java to outperform equivalent C/C++ code
    (no, really) but since they're written by human
    beings, who have real deadlines and targets, the
    optimizations that make it into a release are the
    most common ones. just write your application, and
    then see how it performs. trust me on this
    have a read of
    [url=http://java.sun.com/developer/technicalArticles/I
    nterviews/goetz_qa.html]this for more info anda chance to see where I plagiarized that post from :-)
    Thanks for that link you gave me :)
    Was usefull to read.
    About time and money of programming, that is not really an issue for me atm since i'm doing this project for a company, but through school (it's like working but not for money).
    Of course it should not last entirely long but I got time to figure out alot of things.
    For my next project I will try to focus some more on building first, optimizing performance later (if it can be done with a good margin, since it seems the biggest bottlenecks are not the code but things outside the code).
    @promethuuzz
    The idea was to put collection objects (an object that handles the orm objects initialized) in the request and pass them along to the jsp (this is all done through a customized mvc model).
    So I wanted to see if this method was performance heavy so I won't end up writing the entire app and finding out halve of it is very performance heavy :)

  • AIR and performance questions

    Hey,
    I'm new to AIR mobile development although i have around a decades experience with Flash, but with AIR for mobile i'm a bit lost. So i was hoping someone can answer these questions for me...
    1. Is there currently no way to use a phones vibration with AIR? I remember seeing people asking this on these forums last year, and it still looks as if this extremely simple thing cannot be done? And if it cant, are there plans to have it in AIR 2.7?
    2. When i select GPU acceleration, does it cache all bitmaps automatically? Or do i still have to manually select "Cache as Bitmap" for everything i want cached? (i'm using Flash Pro CS5.5). Because it seems to have no effect on frame rates whatever i do here as long as GPU render mode is selected.
    3. Would i get better performance using vectors or bitmaps for graphics?
    4. Whats the texture size limit for Android and iOS before it can no longer be cached?
    5. Does it matter performance wise if JPG's and PNG's are used for graphics instead of bitmaps? (when i've not selected Cache as Bitmap).
    6. Whats the differences between a AIR for Android and AIR for iOS? I've noticed that for Android it supports use of the camera, for iOS it dont. Is there anything else?
    7. How can i embed a HD video in an AIR for Android app? i've seen this thread: http://forums.adobe.com/thread/849395?tstart=0
    but it's for AIR on iOS, i wouldn't think it's any different for Android, but i'm getting a blank screen when i use the code from that thread (and i'm testing on a Android phone too, not in Flash > Test Movie).
    Or if anyone has ANY tips for performance at all then i'd love to hear them

    Hello,
    I think that Colin may have answered a lot of your questions but here it is:
    1. There is currently no way to make the phone vibrate for within AIR. You can read this post on how to create an Android/AIR hybrid application which gives you extension access to some native functionality. Warning: it is somewhat advanced and not supported by Adobe
    http://www.jamesward.com/2011/05/11/extending-air-for-android/?replytocom=163323
    You can expect to have this functionality in AIR at some point in the future, perhaps not in 2.7
    2. in AIR for Android, there is no need to set GPU if you are only using bitmaps. Cache As Bitmap is only needed for vector art.
    3. Bitmaps would be better but performance is not the only consideration. Remember that memory is limited so bitmaps can use it all so vectors may be a good option if you have a lot of art. A great advantage of using AIR is that you have the option between the two. My recommendation would be that if your art is going to be animated, create it as bitmap or use cacheAsBitmap if it only moves on x and y axis and use CacheAsBitmapMatrix if it transforms in other way (rotation, size).
    4. The limit on Android was 1,024×1,024 last time I checked.
    5. JPGs are smaller in size but PNGs look better. A side note, because the PPI is so high on devices, everything looks great so you can get away with lesser quality assets. Test all options.
    6. The differences between the two platforms are minimal. Camera first but also Android lets you access the media library (where all the images taken by the device are stored) where iOS do not. In general Android is more open.
    7. Video is a very large topic. If you embed the video, you will have a black screen until it is fully loaded. I should say that I did a project with a 1 GB movie and it loaded right away. I have not used the StageWebView to display the movie. Keep in mind that the way the video is endoced matters a great deal (use baseline profile).
    Here is some sample code:
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.events.NetStatusEvent;
    var connection:NetConnection;
    var video:Video;
    video = new Video();
    video.width = 480;
    video.height = 320;
    connection = new NetConnection();
    connection.addEventListener(NetStatusEvent.NET_STATUS, netConnectionEvent);
    connection.connect(null);
    function netConnectionEvent(event:NetStatusEvent):void {
    event.target.removeEventListener(NetStatusEvent.NET_STATUS,
    netConnectionEvent);
    if (event.info.code == "NetConnection.Connect.Success") {
    var stream:NetStream = new NetStream(connection);
    stream.addEventListener(NetStatusEvent.NET_STATUS, netStreamEvent);
    var client:Object = new Object();
    client.onMetaData = onMetaData;
    stream.client = client;
    // attach the stream to the video to display
    video.attachNetStream(stream);
    stream.play("someVideo.flv");
    addChild(video);
    function onMetaData(info:Object):void {}
    I would recommend looking at my book. I cover a lot of these topics in detail (and went through the same hurdles as you):
    http://oreilly.com/catalog/0636920013884
    (you can get it on Amazon too).

Maybe you are looking for

  • Possible to do BDC in a Web service?

    Hi, I need to create a BDC program that can create a Batch Input session. I have a external program that will trigger this BDC program. I was thinking if it is possible to create a RFC that contain the BDC code and eventually created a Web service th

  • [Resolved] Adobe-AIR and some other GTK apps crash

    Gtk-WARNING **: Unable to locate theme engine in module_path: "oxygen-gtk" HTMLLoader failed to initialize How its work? oxygen-gtk are installed and works good with other gtk+ apps. Help me pls. Last edited by sylion (2011-04-17 21:22:37)

  • Message Header

    Can someone pls tell me where I can modify the message header in emails. For exmaple: From: Gallery Center Sent: Tuesday, October 19, 2004 8:57 AM To: Gallery Center Subject: Antique Liquidation Request I would like to change the From: info to includ

  • Receiving a [JavaScript Application] Error upon opening firefox (every time)

    Hi, I just updated to the newest version of firefox (5.0.1) and every time I open a new firefox window (or right click a link and open in a new WINDOW) I get an error that pops up and prevents firefox from opening until I click "ok". the error says [

  • HT1600 My apple tv does not uptdate the data and time and I can not get it to it

    Hello, my apple tv is just dead. It cannot update date and time and I dont have a wayt to access it.