Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Question on heavy mathematical calculations in Java

I am using Java in my project which does a lot of mathematical calculations. In the next iteration of the project, some more calculations will be added. From my knowledge of Java, I suspect that this will cause performance issues. Is it a wise decision to delegate the heavy calculations to a low level language like Fortran or C? I can fire native calls to communicate with the low level languages. Java will take the control once the calculations are performed by Fortran or C. Will this better the performance?

like image 969
Sid Avatar asked Nov 13 '10 11:11

Sid


1 Answers

Be careful not to underestimate modern Java VMs. The first generation ones were awesomely slow, especially at floating-point arithmetic, but modern ones are very quick indeed.

Having said that, other options are probably going to be quicker.

To be sure, you should run some benchmarks. Don't assume one is going to faster than the other, get some concrete performance measurements and make your decision on that basis.

Also consider whether the extra performance (if any) of a "native" solution is worth the extra hassle of writing it and integrating it.

like image 159
skaffman Avatar answered Sep 23 '22 02:09

skaffman