Been a while since I last did some serious Java coding, but I’m thinking of making a little graphics demo (demo as in demoscene).
As performance will be critical, I was wondering about how to store, access and manipulate my data as efficient as possible. I did a little search in this forum and found some posts on this, but they only confused me more:
In this post, its mentioned having objects for models/poly’s and vertices should be the fastest, as using arrays will cause a lot of exception checks to be done:
http://www.java-gaming.org/forums/index.php?topic=11227.0
I did a little benchmark myself and indeed seems to be the case (using objects for model/poly’s/vertices was more than twice as fast as using a float[][][]). Ofcourse this would mean a lot of little objects will be created, but this seems to contradict with this post:
http://www.java-gaming.org/forums/index.php?topic=14940.0
Also mapped objects are mentioned in this forum, but I couldnt make out if theyre better than the object approach, as its mentioned somewhere that its a bit slower than using a float[] :
http://www.java-gaming.org/forums/index.php?topic=12886.0
http://www.java-gaming.org/forums/index.php?topic=15662.0
So performance wise the object approach (a class for model, poly[] and vertice[]) would be fastest?
And last: As i’ll be doing a lot of vector operations, using SIMD instructions would be very welcome. I read the JVM will use SSE instructions where possible, but not very efficient. I found these threads with idea’s of using a little JNI library to handle that:
http://www.java-gaming.org/forums/index.php?topic=12346.15
http://www.java-gaming.org/forums/index.php?topic=17199.msg135213#msg135213
Anyone ever get sopme results from that? Is it feasable?
Thanks!
Martijn