How to improve Script start speed?

Marcus Lagergren marcus.lagergren at oracle.com
Wed Sep 17 08:06:39 UTC 2014


8u40 early builds also have a code caching feature, so that the second to nth runs just deserializes already compiled code, which is useful.

Be aware that due to the new optimistic type system, standard warmup may be a little slower there.

/M

On 16 Sep 2014, at 16:56, A. Sundararajan <sundararajan.athijegannathan at oracle.com> wrote:

> Hi,
> 
> You may want to try jdk8u20. http://www.oracle.com/technetwork/java/javase/8u20-relnotes-2257729.html
> 
> It has changes to improve CompiledScript. Also, you may want to try out 8u40 early access build @ https://jdk8.java.net/download.html
> 
> Thanks,
> -Sundar
> 
> On Tuesday 16 September 2014 07:52 PM, Houtman, Roland wrote:
>> 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.
>> 
>> Anyway.
>> 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  http://stackoverflow.com/questions/25811112/can-nashorn-startup-slowness-be-overcome
>> 
>> 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
>> https://wiki.openjdk.java.net/display/Nashorn/Using+Rhino+JSR-223+engine+with+JDK8
>> but the JDK1.7u45 embedded version is still about 160x faster than the one provided in "rhino1_7R4.zip"
>> 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,
>> Roland
>> 
>> 
>> 
>> 
> 



More information about the nashorn-dev mailing list