Performance issue: Direct Buffer vs non-direct buffer

  3 posts   Feedicon  
Replies: 2 - Last Post: July 30, 2009 13:14
by: DeXtmL
showing 1 - 3 of 3
 
Posted: July 30, 2009 08:42 by DeXtmL
Two FloatBuffer(s):
f1 = BufferUtil.newFloatBuffer(xxxx);
f2 = FloatBuffer.allocate(xxxx);

On my test of them,

for every 10k vbo updates (BufferSubData), the direct buffer out performs the non-direct counterpart by 2~3ms.

I think this is reasonless, because for direct buffer's FloatBuffer view, every get and put goes thru a non-cheap native call (JNI overhead) to convert between the java float primitive with the native bits. But non-direct FloatBuffer doesn't has such overhead.

Can anyone explain this?

dex
 
Posted: July 30, 2009 10:42 by svengothel
Well, our BufferUtil direct buffer uses the native format, not the Java default big-endian format.
So all data read/write from the Java side will be converted .. as you explained.
I would recommend to use these direct native buffers only on low Java computations and for native caching.
JOGL can use the direct native buffers without conversion, hence the performance benefit.
 
Posted: July 30, 2009 13:14 by DeXtmL
well,
As your words suggest,
the JOGL's byte order conversion is less efficient than Java's default calls (Float.intBitsToFloat etc.)? Cuz in either case of my test, the conversion only occur exactly once for each loop.

dex
Replies: 2 - Last Post: July 30, 2009 13:14
by: DeXtmL
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close