Java2D & Native Buffers
trembovetski:
Just a note: ideally we would have all our loops written in Java and
let hotspot worry about proper translation to machine code
(using SIMD or whatever is available) - at least, when rendering
to a heap-based image (like BufferedImage).
We do have a project
which works in this direction - but since it requires a cooperation from
the super-busy vm team, it's not progressing much..
Dmitri
Frederick:
Hi trembovetski :)
I heard that auto-vectorization is really a hard problem and that actually no existing compiler is good at it at the moment. Good to hear that there is work done on it. Personally I wouldn´t mind to write that code by myself, maybe for a particle simulation, skinning or something like that. Maybe java performance is just good enough - time will show - I haven´t pushed my machine to the limit up to now ;D
But when time has come it would be cool to have the opportunity.
Then there is always the tradeoff between speedup and native calling overhead, caused by JNI, to be considered. I suppose SIMD matrix multiplication wouldn´t be much faster than a java version because of that !?
What I really would appreciate is some improved capability to talk to native code, it would be COOL when java could at least partially have memory layout compatible to c++, maybe using structs or something like that. I had to do some workarounds in that area. But I understand that this is not the main application area of java.
Thank you for your nice comments !
Linuxhippy:
There was some discussion about pinning in the VM: As far as I can say nobody should expect pinning to be available anymore.
Hotspot itself does not support pinning, as it would destroy the bump-the-pointer allocation strategy - and because allocation for typical java programs is much more important than java->C data transport I don't think things will change.
The get*Critical Methods themself block the GC, therefor allow to access the data without copying it.
By the way, my old Athlon-Thunderbird-1Ghz (PC100 ram) copied arround with about 800mb/s - so nothing to really worry about anymore :)
lg Clemens
trembovetski:
I have been told that using Get/Set<Type>ArrayRegion may actually be better than
GetPrimitive* .
You might want to try it.
Frederick:
Hey Trembovetski - Thanks ;)
I will definately give that a try... at the moment I am quite busy with learning, so that will have to wait a little. Big thanks, that you asked somebody for it :D
@Linuxhippy: 800mb/s seems impressive first but it is not so if you divide that value by the fps-count. Lets say by 40 - then we will have 20MB per frame. For 2D Animation like video etc. one has send data constantly to the gpu (I am not sure that I want to do THAT ;)). Things like this will keep adding up if one does not care. I am not a hardcore optimizer and i would always prefer simplicity rather than speed - but needless copying is something one really should avoid, I think.
Navigation
[0] Message Index
[*] Previous page