Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (562)
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  
  Java Installation Problems, JVM Is Dead Slow?  (Read 1398 times)
0 Members and 1 Guest are viewing this topic.
Offline Karmington

Senior Member


Medals: 1
Projects: 1


Co-op Freak


« Posted 2009-07-28 13:11:08 »

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?

Online Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2009-07-28 13:15:55 »

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

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Karmington

Senior Member


Medals: 1
Projects: 1


Co-op Freak


« Reply #2 - Posted 2009-07-28 14:07:05 »

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(); 



Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CommanderKeith
« Reply #3 - Posted 2009-07-28 14:22:23 »

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

Offline zammbi

JGO Coder


Medals: 4



« Reply #4 - Posted 2009-07-28 14:25:37 »

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

Current project - Rename and Sort
Offline Karmington

Senior Member


Medals: 1
Projects: 1


Co-op Freak


« Reply #5 - Posted 2009-07-28 14:38:07 »

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

Offline ryanm

Senior Member


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #6 - Posted 2009-07-28 14:56:08 »

Quote from: Karmington link=topic=20905.msg170281#msg170281
long now = (new Date()).getTime(); // milliseconds

Off-topic, but you should use System.currentTimeMillis() instead of constructing a Date object every time.
Offline CommanderKeith
« Reply #7 - Posted 2009-07-29 06:25:16 »

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.

Offline Karmington

Senior Member


Medals: 1
Projects: 1


Co-op Freak


« Reply #8 - Posted 2009-07-29 10:45:45 »

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

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #9 - Posted 2009-07-29 11:44:44 »

what is exclusive rendering Grin
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 (22 views)
2014-09-21 02:42:18

BurntPizza (15 views)
2014-09-21 01:30:30

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

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

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

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

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

TehJavaDev (97 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
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!