Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 1191 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 »

Quote
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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (8 views)
2014-09-21 00:34:41

moogie (7 views)
2014-09-21 00:26:15

UprightPath (22 views)
2014-09-20 20:14:06

BurntPizza (27 views)
2014-09-19 03:14:18

Dwinin (40 views)
2014-09-12 09:08:26

Norakomi (70 views)
2014-09-10 13:57:51

TehJavaDev (96 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56

mitcheeb (70 views)
2014-09-08 06:06:29

BurntPizza (52 views)
2014-09-07 01:13:42
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!