Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
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  
  Terrible VertexArrayRange performance  (Read 3821 times)
0 Members and 1 Guest are viewing this topic.
Offline abies

Senior Member





« Posted 2003-06-22 08:36:07 »

I have downloaded original C nvidia demo and done some comparisons.

Jogl version - 8 and 6 fps (VAR and non-var)
Nvidia version - 30 and 15 fps (VAR and non var)

Removing rendering from jogl version does not help much - I'm at 10-12 fps max. It seems that performance kill comes from 6 FloatBuffer puts inside innermost loop. Commenting them out sends performance through the roof - into 40-50fps range (nothing is rendered, but this is same nothing as with commenting out DrawElements, which gives only 10-12 fps) - and this is with drawElements and rest of loop in place.

There used to be discussion about it some time ago - and it turned out that hotspot is not smart enough to discover that given buffer is directly mapped to memory and thus going through some major hops to access it.

Anyway, this is not really jogl problem, but java/hotspot problem. But I'm afraid that 3-4 times slowdown on any code which uses memory arrays directly (for speed...) is not acceptable.

I vaguely remember there was some trick to fix it - something like making DirectByteBuffer public and casting all buffers to it. Does anybody remember anything more, or have a link for that discussion ?

I'm posting it here, not on performance board, because it is most critical for jogl and shows in jogl 'performance' example. And it is jogl which will have major problems if it is not fixed...

Artur Biesiadowski
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #1 - Posted 2003-06-22 09:23:46 »

where's the original code?
I'd like to test this with LWJGL ...

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2003-06-22 09:32:48 »

Oops, I was going to paste the code here, but the forum complains the message is too long.

Anyway, the file is VertexArrayRange.java, in the jogl/demos/vertexArrayRange dir of the CVS: http://jogl.dev.java.net/source/browse/jogl/demos/vertexArrayRange/

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline AndersDahlberg

Junior Member





« Reply #3 - Posted 2003-06-22 09:55:01 »

Maybe this thread is of some interest? (old, but the only one I found :-/)

http://www.java-gaming.org/discus/messages/27/1400.html?1025552520
Offline abies

Senior Member





« Reply #4 - Posted 2003-06-22 10:46:02 »

Anders - thanks for the pointer. This helped me to discover what is happening.

In short - java1.4.2b1 sucks.

Longer story - when I have run VertexArrayRange with java 1.4.0_something, I have 30 fps. It might be something like 29.5 compared to 30.5 with nvidia version, but difference is neglible. With -client instead of -server, fps is 26-27 - still acceptable.

It seems that java1.4.2b1 buffer access has suffered from serious regression.

Raw data for you:







JVMFloat arrayDirect buffer
1.4.0_01, client81.1175.2
1.4.2b1, client69.1848.2
1.4.0_01, server13.013.0
1.4.2b1, server8.1880.2


While normal array performance has improved considerably, direct buffer was killed. Especially look at server - from 13 to 880 !!!!

You can get test program from link provided by Anders - use my corrected version to get above results. Program will claim that unit is uS, but I'm not sure about it - anyway, it is some kind of time per unit of work, not important how much it is absolutely, important is that it is computed in same way in both cases and can be compared in relative manner.

I can look at bugparade and file a performance regression bug, but then it will be good if it will get fixed in 1.5... Maybe some of Sun insiders here can check what is really happening and bug one of Hotspot engineers about that ?

Edit:
Cas, would it be possible that you test this code with jet ? Of course, you would need to rerun it with normal java, to get base result on your computer - but I wonder how well jet is able to optimize this stuff.

Edit:
http://nwn-j3d.sourceforge.net/misc/BufferMark.java
Download and run. I have tried to find number of iterations which is still meaningful under 1.4 and bearable to wait for under 1.4.2b1.

Artur Biesiadowski
Offline abies

Senior Member





« Reply #5 - Posted 2003-06-22 11:59:08 »

http://developer.java.sun.com/developer/bugParade/bugs/4851535.html

It tells exactly about out Vertex test problem.

Evalutation claims factor 5-6 perfomance slowdown, I see 80 times slowdown, but rest seems ok. They say they have already fixed it, so I guess we can be happy now.

Artur Biesiadowski
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #6 - Posted 2003-06-23 06:24:55 »

The fix will show up in the next beta of 1.4.2.
Offline abies

Senior Member





« Reply #7 - Posted 2003-06-27 19:14:01 »

After downloading jdk1.4.2 I have rechecked both demo and benchmark. 1.4.2 is quite faster than 1.4.0 at array access and a bit slower for buffer access - but we are taking about 5-10% slower here, not about 80x. VertexArrayBuffer difference is about 0.5fps (1.4.0 is better) - but still witing range of C++ version.

I guess this bug got fixed indeed - thanks.

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

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

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

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

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

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

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (28 views)
2014-09-07 01:12:14

Longarmx (34 views)
2014-09-07 01:11:22

Longarmx (34 views)
2014-09-07 01:10:19

mitcheeb (40 views)
2014-09-04 23:08:59
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!