This repository was archived by the owner on May 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
main/java/com/mycompany/app
test/java/com/mycompany/app Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ static long benchNashornScriptEngine() throws IOException {
108108 }
109109 }
110110
111- private static long benchGraalScriptEngine () throws IOException {
111+ static long benchGraalScriptEngine () throws IOException {
112112 System .out .println ("=== Graal.js via javax.script.ScriptEngine ===" );
113113 ScriptEngine graaljsEngine = new ScriptEngineManager ().getEngineByName ("graal.js" );
114114 if (graaljsEngine == null ) {
Original file line number Diff line number Diff line change 11package com .mycompany .app ;
22
33import static org .junit .Assert .fail ;
4+ import org .junit .BeforeClass ;
45import org .junit .Test ;
56
67public class AppTest {
8+ private static long nashorn ;
9+
10+ @ BeforeClass
11+ public static void nashornBenchmark () throws Exception {
12+ nashorn = App .benchNashornScriptEngine ();
13+ }
14+
715 @ Test
8- public void testSpeed () throws Exception {
9- long nashorn = App .benchNashornScriptEngine ();
16+ public void testGraalPolyglotSpeed () throws Exception {
1017 long graalJS = App .benchGraalPolyglotContext ();
1118 if (nashorn < graalJS ) {
1219 fail (String .format ("Graal.js (%d ms) should be faster than Nashorn (%d ms)." , graalJS , nashorn ));
1320 }
1421 }
22+
23+ @ Test
24+ public void testGraalScriptEngineSpeed () throws Exception {
25+ long graalJS = App .benchGraalScriptEngine ();
26+ if (nashorn < graalJS ) {
27+ fail (String .format ("Graal.js (%d ms) should be faster than Nashorn (%d ms)." , graalJS , nashorn ));
28+ }
29+ }
1530}
You can’t perform that action at this time.
0 commit comments