Faster Math ?

Laurent Bourgès bourges.laurent at
Thu Nov 9 13:33:15 UTC 2017

I checked in the latest jdk master and both cbrt / acos are NOT intrinsics.

However, cbrt(x) = pow(x, 1/3) so it may be optmized...

Could someone tell me how cbrt() is concretely implemented ?

In native libfdm, there is no e_cbrt.c !

Thanks for your help,

Le 9 nov. 2017 10:52 AM, "Jonas Konrad" <me at> a écrit :

> Hey,
> Most functions in the Math class are intrinsic (
> share/vm/classfile/vmSymbols.hpp#l664 ) and will use native instructions
> where available. You can also test this yourself using jitwatch. There is
> no native call overhead.
> The standard library does not currently include less accurate but faster
> Math functions, maybe someone else can answer if that is something to be
> considered.
> - Jonas Konrad
> On 11/09/2017 10:00 AM, Laurent Bourgès wrote:
>> Hi,
>> The Marlin renderer (JEP265) uses few Math functions: sqrt, cbrt, acos...
>> Could you check if the current JDK uses C2 intrinsics or libfdm (native /
>> JNI overhead?) and tell me if such functions are already highly optimized
>> in jdk9 or 10 ?
>> Some people have implemented their own fast Math like Apache Commons Math
>> or JaFaMa libraries that are 10x faster for acos / cbrt.
>> I wonder if I should implement my own cbrt function (cubics) in pure java
>> as I do not need the highest accuracy but SPEED.
>> Would it sound possible to have a JDK FastMath public API (lots faster but
>> less accurate?)
>> Do you know if recent CPU (intel?) have dedicated instructions for such
>> math operations ?
>> Why not use it instead?
>> Maybe that's part of the new Vectorization API (panama) ?
>> Cheers,
>> Laurent Bourges

More information about the core-libs-dev mailing list