How to improve Script start speed?

Houtman, Roland Roland.Houtman at
Tue Sep 16 14:22:50 UTC 2014

Dear Dev,

I'm using Rhino with JDK1.7u45, which runs really fast.
Each 500 msec, I run 200 Swingworker instances each executing a small CompiledScript instance with their own SimpleScriptContext.
The scripts are just 5 lines of javascript-code without a loop.

I see a big performance difference with regard to creating a CompiledScript object and calling eval() on it.
With Rhino it's running immediately at a nice speed.
But with Nashorn, it takes about 15 seconds for the engine to run stable.
Pictures I put here on stackoverflow

The startup-lag is not workable for what we use the scripts for.
I would appreciate any insight in using Nashorn more optimal.

On a sidenote, I also tried running Rhino as separate jar In both Java7 and Java8, as per
but the JDK1.7u45 embedded version is still about 160x faster than the one provided in ""
So for Java8, I'm facing some difficulties.

I'm testing with
c:\Program Files (x86)\Java\jdk1.8.0\bin>java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode, sharing)

Kind regards,

More information about the nashorn-dev mailing list