use of jdk.nashorn.api.scripting.NashornScriptEngine in project java8-tutorial by winterbe.
the class Nashorn10 method main.
public static void main(String[] args) throws ScriptException, NoSuchMethodException {
NashornScriptEngine engine = (NashornScriptEngine) new ScriptEngineManager().getEngineByName("nashorn");
engine.eval("load('res/nashorn10.js')");
long t0 = System.nanoTime();
for (int i = 0; i < 100000; i++) {
engine.invokeFunction("testPerf");
}
long took = System.nanoTime() - t0;
System.out.format("Elapsed time: %d ms", TimeUnit.NANOSECONDS.toMillis(took));
}
Aggregations