Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (739)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (820)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Odd performance observation  (Read 1784 times)
0 Members and 1 Guest are viewing this topic.
Offline kcpeppe

Senior Newbie

Type safety is for the weak

« Posted 2004-11-26 17:27:16 »

Ok, this isn't a gaming related observation but it is performance related. What I have is a benchmark that has been run by several people in a number of different environments and JDKs. The list includes HP-UX, Solaris 5.9, Mandrake linux, SuSe Linux, W2K, and XP. JDKs include 1.4.2_02, 1.4.2_04, 1.4.2_5 and the latest 1.5.0.

What I did was setup a micro-benchmark (Jeff hold your tongue, I know it's a loaded weapon pointed at my foot Smiley) to look at the performance of the new for loop. I totally expected that the run times and memory profiles for each scenario would looke the same and those were the results that I got. What I didn't expect to see was some strange numbers on my XP box. First to explain the test.

- setup fixtures for the test
- run the test to pre-heat the VM
- call System.gc();
- call sleep( 1000);
- repeat many times
     - run the test (start timer, test, stop timer)
     - call gc
     - sleep

When I run this test in XP, I see a run time of about 200ms. This is result is repeatable in other XP environments and does not seem to depend on the version of the JDK.

If I eliminate the sleep, the run time DROPS to about 80ms (and no, the sleep is not in the metered section of code).

When I run this test on any of the other hardward/OS combinations, the numbers look ok.

So as bizzare as it sounds, some how, in XP, calling sleep affects how the thread will run AFTER sleep has long finished. I've looked at Java thread priority and it's rock stable at 5. I can't see how it can be a thread scheduling problem coming out of sleep since the thread is needs to be running to start the timer and perform the unit of work.

So the question here is, does anyone have any idea what might be going on?
Offline mhale

Senior Newbie

Take pity, I'm just a poor blob!

« Reply #1 - Posted 2004-11-27 00:18:45 »

Maybe Windows swapped out the process during the sleep, hence it had to take time to swap it back in.
Offline kcpeppe

Senior Newbie

Type safety is for the weak

« Reply #2 - Posted 2004-11-27 06:25:01 »

Maybe Windows swapped out the process during the sleep, hence it had to take time to swap it back in.

Interesting thought.....

I run with no swap. For the purposes of this exercise, I did configure a 1 gig swap space to make sure that the no swap space configuration was not at the root of the problem. That said, I suspect that XP silently configures some minimal amount of swap space that you can't eliminate.

Although I didn't note any disk activity during the test, I wasn't expecting any and didn't watch as closely as I should have Roll Eyes. I just re-ran the test and this disk was fairly (but not 100%) quiet during the run. So it would seem as though the running process does trigger some extremely small amount of disk activity. This leads me to believe that everything may be sitting in (disk) cache and given that the system is otherwise idle, this amount of disk activity is only enough to trigger a sporadic read/write operation.

So, if the process is partly swapped out but only to disk cache (speculation here), then that might account for some of the difference. That said, I'm not sure that it should/account for a more than doubling of the timings.

I just had a run on a Mac and those numbers looked pretty clean so it's looking more and more like this behavior is unique to XP.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Ecumene (51 views)
2017-09-30 02:57:34

theagentd (76 views)
2017-09-26 18:23:31

cybrmynd (183 views)
2017-08-02 12:28:51

cybrmynd (181 views)
2017-08-02 12:19:43

cybrmynd (188 views)
2017-08-02 12:18:09

Sralse (197 views)
2017-07-25 17:13:48

Archive (747 views)
2017-04-27 17:45:51

buddyBro (880 views)
2017-04-05 03:38:00

CopyableCougar4 (1429 views)
2017-03-24 15:39:42

theagentd (1319 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!