Java Installation Problems, JVM Is Dead Slow?

Serious Problem: my game runs at a nice 75 fps on most computers.
But the one I’m working on is running it at 13 fps…
The same framerate whether I tun it from Eclipse or as Executable jar.
Tried cleaning Java, removed and reinstalled, no difference.

What can be done to diagnose the problem?

[x] OS on both machines?
[x] CPU on both machines?
[x] GPU on both machines?
[x] JVM version on both machines?
[x] What are you rendering?
[x] What timing do you use (nanoTime / currentTimeMillis)
[x] How do you pause ( sleep / yield ) ?

Ok, heres the info :
75 fps:
OS - Windows XP sp3
CPU - Pentium 4 3.0 GHz
GPU - Intel 82915G/GV/910GL Express Chipset Family
JVM - 1.6.0_07

13 fps:
OS - Windows XP sp3
CPU - AMD AThlon 64 Processor 4000+ 2.4 GHz
GPU - NVIDIA GEForce 7600GT
JVM - 1.6.0_07

( Im using _07 because Eclipse Debugging is not working
properly in the newest java update. )

I’m rendering a 2d racing game, using BufferedImage:s mostly.
Trying out BufferStrategy to make fullscreen right now, but it makes
no difference.

The render loop is using
long now = (new Date()).getTime(); // milliseconds
and pause is
Thread.currentThread().yield();

Try this VM option and post the output on the two machines:

-Dsun.java2d.trace=,count

My guess is that java2d is using different rendering pipelines for some reason

iirc Java doesn’t let Intel chips do hardware acceleration. Which is weird that computer has the most FPS.

This is just the main menu… frame rate difference still applies
Cant spot any real differences here…
[EDIT] fixed the getCurrentTime() as suggested

13 fps:

679 calls to sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
2 calls to GDIFillRect
107 calls to sun.java2d.windows.GDIBlitLoops::Blit(IntRgb, SrcNoEa, “GDI”)
1728 calls to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntRgb)
436 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
1 call to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntArgb)
3566 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
3566 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, IntRgb)
1 call to sun.java2d.loops.TransformHelper::TransformHelper(IntArgb, SrcNoEa, IntArgbPre)
359 calls to sun.java2d.loops.TransformHelper::TransformHelper(ByteIndexedBm, SrcNoEa, IntArgbPre)
330 calls to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntRgb)
10795 total calls to 11 different primitives

75 fps:

771 calls to sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
2 calls to GDIFillRect
1 call to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntArgb)
2208 calls to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntRgb)
1 call to sun.java2d.loops.TransformHelper::TransformHelper(IntArgb, SrcNoEa, IntArgbPre)
552 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
420 calls to sun.java2d.loops.Blit::Blit(ByteIndexedBm, SrcOverNoEa, IntRgb)
4562 calls to sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, IntRgb)
141 calls to sun.java2d.windows.GDIBlitLoops::Blit(IntRgb, SrcNoEa, “GDI”)
4572 calls to sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
359 calls to sun.java2d.loops.TransformHelper::TransformHelper(ByteIndexedBm, SrcNoEa, IntArgbPre)
13603 total calls to 11 different primitives

Off-topic, but you should use System.currentTimeMillis() instead of constructing a Date object every time.

I replied to this last night but the post disappeared… grr!

Well by the looks of the output java2D is not using the Direct3D graphics pipeline in either JVM - they’re both using software rendering (sun.java2d.loops) which is much slower since that runs on the CPU rather than the GPU. Since both of your machines have good graphics cards using the D3D pipeline is a better option.

If you upgrade to java 6 update 10 or more recent, then the improved D3D pipeline will be enabled by default which should see speed ups on both machines. As for why one computer runs slower than the other, well the AMD has a slightly slower processor, and maybe it has a smaller cache or less/slower RAM or something??

PS: Thread.yield() can pause for different times on different systems, try getting rid of it and not sleeping/yielding at all.

Ok, Once I got it into Exclusive fullscreen mode the fps on the slow renderer went up to the good 60-70 fps,
Thank goodness for that! And thanks for the tips, particularly the trace from CommanderKeith!

Couple of last questions:

The exclusive Render is only in fullScreen?
The exclusive Render is only in Applications, not Applets?

[SHY EDIT] Full-Screen Exclusive Mode API
http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html

shakes head getting tired of seeing things compile nicely in dev,
but then my listeners tdont work in exe jar? why…

what is exclusive rendering ;D