Major Performance Issues with Java 8 ScriptEngine Compared to Java 7

后端 未结 1 1053
余生分开走
余生分开走 2021-02-05 09:17

I have a Java program (compiled using JDK 7u80) which makes extensive use of the \"JavaScript\" ScriptEngine (JSR-223). I have noticed that my program runs extremely slow when e

1条回答
  •  深忆病人
    2021-02-05 09:30

    Java 8 improve the JavaScript engine, if you use the compile compiledScript way, to not reevaluate the source code each time. With the eval method, Hashorm engine used in jdk8 is slower than Rhino used in jdk7, but more secure.

    Prefer a StringBuffer vs a String , and usage of constants for Math.pow(2, 32) and Math.pow(256, 3) values if you looking for speed...

    Yours

    0 讨论(0)
提交回复
热议问题