faster Math.exp() via JNI?

前端 未结 15 645
时光取名叫无心
时光取名叫无心 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:31

    The real question is, has this become a bottle neck for you? Have you profiled your application and found this to be a major cause of slow down?

    If not, I would recommend using Java's version. Try not to pre-optimize as this will just cause development slow down. You may spend an extended amount of time on a problem that may not be a problem.

    That being said, I think your test gave you your answer. If jni + C is slower, use java's version.

提交回复
热议问题