faster Math.exp() via JNI?

前端 未结 15 727
时光取名叫无心
时光取名叫无心 2021-01-11 22:43

I need to calculate Math.exp() from java very frequently, is it possible to get a native version to run faster than java\'s Math.exp()

15条回答
  •  忘掉有多难
    2021-01-11 23:19

    Since the Java code will get compiled to native code with the just-in-time (JIT) compiler, there's really no reason to use JNI to call native code.

    Also, you shouldn't cache the results of a method where the input parameters are floating-point real numbers. The gains obtained in time will be very much lost in amount of space used.

提交回复
热议问题