Wow. Nice find.
Maybe time to write a bug-report?
Wow. Nice find.
Maybe time to write a bug-report?
I reckon so.
Note the logarithmic scale. IntBuffer bulk puts are essentially free, and I can’t see any reason why FloatBuffers can’t do the same.
Benchmark code here. Can anyone spot any problems with this?
Looks good enough.
Seems like floats are 266x slower than ints. It probably goes through the FPU instead of a memcpy.
Add your stars to Issue 11078.
edit: actually don’t bother, it’s been fixed in Gingerbread already apparently
Also, there’s a more-or-less drop-in replacement for FloatBuffer over here. It’ll automatically convert float arrays that you give it, and also allow you to pass in pre-converted int arrays
Too bad that 3.0 has some hefty hardware requirements and most likely wont make it to a lot of current phones…
I’m late to the party but i wanted to follow up on this. First off: thanks Ryan for posting that bug report. I went with bulk puts and never thought about testing single puts (old nio habit…). I wrote a quick JNI method which is even faster than your in[] array trick. You can find more info at http://apistudios.com/hosted/marzec/badlogic/wordpress/?p=904.