|
|
|||||||
|
I spend a lot of time checking how to improwe math in Java. JNI appeared to be the worst choice!!! 1. All the results I got were at first exactly same as authors. However, once I used -server option for jvm all the results were diferent -> Normal Java Math.sin/cos become faster than JNI calls!!! (and jni speed was not so much improved) (jvm 1.4.1 and 1.4.2) 2. Results were even better when I used (in java) simple precalculated array of sinuses (already mentioned in discussion). Lessons learned (by me): a) always check yourself ! b) do not forget -server option !!!!!!!!!! (there are others important also (check -XX options) c) if You really need You can always speed up performance doing changes in Your java code !!! -> all nasty tricks from game developers, hackers in C/C++ still work in JAVA :-O !!!! (would You believe that once in a book for C++ I found a trick with bits that allows for faster float to int conversion (faster than normal (float)int_variable statement) -> it works great also with java!). |