graal-js-jdk11-maven-demo icon indicating copy to clipboard operation
graal-js-jdk11-maven-demo copied to clipboard

GraalJS significantly slower than Nashorn when running on OpenJ9 JVM

Open thjaeckle opened this issue 4 years ago • 2 comments

When running against OpenJ9 JVM (JDK11)

me@ubuntu:~/git/graal-js-jdk11-maven-demo$ export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-11-openj9-amd64
me@ubuntu:~/git/graal-js-jdk11-maven-demo$ mvn package

I get the following output:

=== Nashorn via javax.script.ScriptEngine ===
Warning: Nashorn engine is planned to be removed from a future JDK release
warming up ...
warmup finished, now measuring
iteration: 515
iteration: 497
iteration: 515
iteration: 463
iteration: 503
iteration: 520
iteration: 467
iteration: 464
iteration: 479
iteration: 473
=== Graal.js via org.graalvm.polyglot.Context === 
warming up ...
warmup finished, now measuring
iteration: 2856
iteration: 2811
iteration: 2888
iteration: 2874
iteration: 2825
iteration: 2822
iteration: 2978
iteration: 2895
iteration: 3073
iteration: 2926
=== Graal.js via javax.script.ScriptEngine ===
warming up ...
warmup finished, now measuring
iteration: 3091
iteration: 3070
iteration: 2812
iteration: 2952
iteration: 2858
iteration: 2862
iteration: 2842
iteration: 2832
iteration: 2748
iteration: 2823

[ERROR] Failures: 
[ERROR]   AppTest.testGraalPolyglotSpeed:61 Graal.js (2926 ms) should be faster than Nashorn (473 ms).
[ERROR]   AppTest.testGraalScriptEngineSpeed:70 Graal.js (2823 ms) should be faster than Nashorn (473 ms).

When running with hotspot, GraalJS beats Nashorn (and is overall faster than with OpenJ9 JVM). It this an known/expected result?

thjaeckle avatar Nov 20 '20 12:11 thjaeckle

From what I understand GraalJS runs in pure interpreter mode when not running on GraalVM (which it autoenables in the pom for jdk11). Nashorn compiles JS to JVM bytecode.

mwisnicki avatar Aug 07 '21 20:08 mwisnicki

I confirm it's far slower on jdk 8 or 11.

Plus I was not able to use graalvm-ce-java11-22.0.0.2 Plus I was not able to run mvn exec:exec on Windows: problem with the ":" in the path?

java.nio.file.InvalidPathException: Illegal char <:> at index 73: D:\dev_test\graal-js-jdk11-maven-demo-master\target/compiler/compiler.jar:D:\dev_test\graal-js-jdk11-maven-demo-master\target/compiler/compiler-management.jar

antsfiles avatar Mar 17 '22 12:03 antsfiles