Interesting. We use on global context and create a new engine context with each run. The initial compile of several scripts is over 100ms, but then we see that drop to under 10ms. The context creation seems to have very little overhead. We have not timed that specifically though, just total process time.
We use the built in Nashorn compiles, not compilable. On Jun 14, 2016 12:21 PM, "Axel Dörfler" <ax...@pinc-software.de> wrote: > Am 14/06/2016 um 17:52 schrieb Tony Zakula: > >> Have you tried reusing the engine and only creating a new Context for >> every run? >> > > Sure, but creating a new ScriptContext has a substantial overhead. > AFAICT sharing the engine only enables caching the compiled scripts, as > well as making Compilables work. IIRC both (reuse context, reuse engine) > had a similar impact on performance. > > Also, have you turned on caching for scripts as the engine >> parameter? We have seen good performance doing that. Would be >> interested to know if you do. >> > > I'm not sure what you mean. AFAIK Nashorn caches scripts automatically as > soon as you start reusing your engine, you don't even have to use > Compilables. > > Bye, > Axel. > >