Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 6013 times)
0 Members and 1 Guest are viewing this topic.
Offline abies

Senior Devvie

« 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: 57
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, in the jogl/demos/vertexArrayRange dir of the CVS:

[ - 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 Devvie

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

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

Senior Devvie

« 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 ?

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.

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 Devvie

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

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 Devvie

« 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  

EgonOlsen (45 views)
2018-06-10 19:43:48

EgonOlsen (25 views)
2018-06-10 19:43:44

EgonOlsen (47 views)
2018-06-10 19:43:20

DesertCoockie (202 views)
2018-05-13 18:23:11

nelsongames (127 views)
2018-04-24 18:15:36

nelsongames (126 views)
2018-04-24 18:14:32

ivj94 (867 views)
2018-03-24 14:47:39

ivj94 (128 views)
2018-03-24 14:46:31

ivj94 (771 views)
2018-03-24 14:43:53

Solater (143 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

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