Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958403

Pages: 1
Jarek Ratajski
Unregistered




Beware JNI! Wrong way. :-)
      #21674 - 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!).


Post Extras: Print Post   Remind Me!   Notify Moderator  
Paul Gresham
Unregistered




Re: Beware JNI! Wrong way. :-) [Re: Jarek Ratajski]
      #27511 - 02/26/06 04:22 PM

-server JIT optimisations are fantastic and this is true for many aspects of Java ... remember under windows to get access to the Server JVM you need to download the SDK and use the JRE within the SDK folder ... not a problem for you developers/server users, but just think about the client side deployment issues if you've got heavy processing in that area ... mind you ... it may just be far more difficult than bundling a JNI based DLL in your jnlp/jar

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 7842

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5