why Java Math slower than C Math?

Manfred Bergmann bergmannmd@web.de
Tue Feb 25 11:57:00 GMT 2003


Hi,

I am doing some performance tests between C/C++ and Java.
An algorithm performs on a lot of float elements in an array where
quite often math-functions (abs, min, max) are called.
On the same code-base, Java performs unoptimized slower than C.
With -O3 optimization both have nearly the same performance.
AFAIK, all java.lang.Math methods are declared static, does this
mean, that they are made to inline-funktions with a -O3 optimization
and with that Java is as fast as C?


Greets,
Manfred



More information about the Java mailing list