**DONOTDELETE**
(Unregistered)
09/10/05 03:42 AM
Beware JNI! Wrong way. :-)

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!).


**DONOTDELETE**
(Unregistered)
02/26/06 04:22 PM
Re: Beware JNI! Wrong way. :-)

-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


Contact us JavaWorld

Powered by UBB.threads™ 6.5.5

Featured White Papers


RESEARCH CENTERS: Java Standard Edition | Java Enterprise Edition | Java Micro Edition | Development Tools
About Us | Advertise | Contact Us | Terms of Service/Privacy
Copyright, 2006-2008 Network World, Inc. All rights reserved.