Faster Math ?

Jonas Konrad me at
Thu Nov 9 09:51:17 UTC 2017


Most functions in the Math class are intrinsic ( 
) 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 

- 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