Any plans for optimizing engine.eval() ?

Houtman, Roland Roland.Houtman at nl.yokogawa.com
Wed Sep 24 09:12:39 UTC 2014


Hi Dev,

The first time a script is run, Nashorn seems to rely on the interpreting the script. But it isn't performing as Rhino did (at all).
I've tried the engines coming with the following JDK's
JDK 1.7u45 
JKD 1.8u20 
JDK 1.8.0_40 (build 6)

The time I measured is the total execution time of 200 separate instances with all different scripts, all running only once.
(The test script is a nothing more than getting an object from an array, do an if/else, and storing the result in another array.)

--
JDK 1.7u45 CompiledScript.eval()	219 msec
-
JKD 1.8u20 CompiledScript.eval()	13613 msec
JDK 1.8u20 Engine.eval()		14002 msec
-
JDK 1.8.0_40 CompiledScript.eval()	26396 msec
--

I notice that it takes up to 60 seconds before Nashorn is ready creating&loading classes to run, and running at good speed.
In that timespan execution is very slow. (and seems to by interpreting the script far less optimal than Rhino)

Can anyone give me insight in what is happening and where/how to seek improvements?

Regards,
Roland


More information about the nashorn-dev mailing list