Hello,
I stumbled upon this document:
http://lingpipe-blog.com/2009/03/30/jdk-7-twice-as-fast-as-jdk-6-for-arrays-and-arithmetic/
Shortly, test that article writer did 'proved' that Java7 is twice as fast in array accessing/writing and simple arithmetics. Apparently he executed stress test and compared the results.
Since those primitives are supposed to get heavily optimized,
then just for discussion and theory,
would it be of any benefit to re-implement core JME math classes in a way to back them with an array?
I'm just guessing, but we do multiply vectors and matrices thousands of times during one game cycle, it might actually pay off?
Please comment
All versions of jME use separate variables for matrices, instead of arrays. But this might help with other array based operations in jME. The arithmetic optimizations might be useful also, for software animation skinning and such. What I was hoping for was better use of SSE instructions, so that something like this:
x = x * x1 + x2
y = y * y1 + y2
z = z * z1 + z2
w = w * w1 + w2
Will get optimized into an SEE ADDPS and MULPS instructions for example.
Hm, I think its too complicated and doesn't really work that well for this use case. What we really need is not more abstraction, but rather functionality at lower level, and that can only be accomplished by optimizing the code I provided inside the JVM with SSE or other ASM-level optimizations.