Question on the speed of c code when called from Java
:oI am a graduate student working on a research project. I am writing my interface in Java using JEE environment (so Java servlets with Apache). This is not the point of the question though so I didn't stick this in a different thread. The point of the question is that I need to call some native code from Java (c, c++) which is very computationally expensive and includes advanced numerical approximations along with advanced math concepts, and I need it to be fast! I don't want to rewrite the code in Java for a few reasons. Some of these reasons are that Java can not compute them as fast as something such as c and I don't have all year to rewrite everything. I came across a java tool called the Java native Interface that allows you to do this. The question I have is speed.
-When c is called by Java in this way does it invoke say a gcc compiler and run the c code in its native environment or does it run it through the Java Virtual Machine and other APIs?
-If the c code has to run through the Java compiler then is there a way to just call a compiled c program from Java and not compute anything from the Java compiler?
-If I don't get any speed benefits in calling c from Java in the above manner, is there a way that I can?
-Any suggestions on getting the speed benefits of c out of Java differently?
If I am asking the wrong questions then please let me know. The piont is I want the interface to be in Java and I want the complex and high computationally intensive tasks to be in c. There are several reasons why I want to use c for this part, but the biggest is speed differences compared to writing something like this in Java.
Any help would be appreciated.
Thanks, Steven Miller :)