Extremely slow startup performance

Sia Lang silverlanguage at gmail.com
Wed Jul 2 11:00:57 UTC 2014

I'm using u5. Note that while coffee-script.js is 204K, v8 swallows it
subsecond. Nashorn is very slow on startup even for the smallest of scripts.

The proposed caching would likely solve the problem - the initial load time
(2-3 minutes), I can count as part of the application installation :)

Followup questions:

1) By persistent code store, do you mean that the caching survive process
restarts? That would be nice indeed.

2) What's the jit granularity? eval() ?

3) When will u40 be out? :)


On Wed, Jul 2, 2014 at 12:18 PM, Marcus Lagergren <
marcus.lagergren at oracle.com> wrote:

> Hi Lang!
> We are aware of there being a couple of warmup issues in Nashorn. My guess
> is that “coffee-script.js” is a fairly large script, Nashorn currently
> compiles everything to byte code and therefore takes time.
> In JDK9, the follow changes have already been checked in, that may help
> you:
> * Lazy code generation policy on by default - less byte code generation
> * Class caching - reuse of compiled classes
> * Persistent code store on disk - basically identical code is never jitted
> more than once. If you compile identical source code, in these scripts,
> only the first run would be slow. This might help you out immensely. If you
> need the first run to go fast, we need to improve general warmup, and we
> are currently discussing how to do it. It’s on the table.
> And the following that might make it a little bit worse, until we’ve had
> more time to property attack the warmup issues.
> * Optimistic type optimization (may actually increase warmup)
> These will be backported to 8u40.
> What version of the JDK/nashorn are you using? Perhaps you could send us a
> Java Flight Recording of your recording of your slow startup, if you want
> us to look at it in detail. JFR files are always helpful.
> Regards
> Marcus
> On 02 Jul 2014, at 11:21, Sia Lang <silverlanguage at gmail.com> wrote:
> > I'm trying to use Nashorn as a plugin framework.
> >
> > However, code like:
> >
> >    engine.eval(new BufferedReader(new FileReader("coffee-script.js")));
> >
> > easily takes 10-15 seconds. V8 uses a few milliseconds (when using jav8
> as
> > scriptengine)
> >
> > In my opinion, Nashorn is so slow on startup it's useless (I have tons of
> > plugin scripts, which accumulates to 2-3 minutes of application startup
> > time due to nashorn - with v8 i'm subsecond!)
> >
> > What's going on? Anything I can do to fix this?
> >
> > Lang

More information about the nashorn-dev mailing list