Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.
Jarek Ratajski
Unregistered
|
Beware JNI! Wrong way. :-)
09/10/05 03:42 AM
|
|
|
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!).
|
|
0 registered and 1 anonymous users are browsing this forum.
Moderator:
|
Forum Permissions
You cannot start new topics
You cannot reply to topics
HTML is disabled
UBBCode is enabled
|
Rating:
Thread views: 7809
|
|
|
|
|
|
Powered by UBB.threads™ 6.5.5