Am 20.09.2013 12:56, schrieb Benjamin Sieffert:
[...]
> Then we retrieve our javascript-side "scriptrunner" object by calling
> .compile(javascript).eval() on the engine. (So we get a compiled script
> at this point, but that is not the object we store and use.)

can't you reuse the compiled scripts? Depending no how that is 
implemented it could improve the situation

> Now the "scriptrunner" is set up to fit our needs. We work with it by
> calling engine.invokeMethod(scriptrunner, "methodname", arguments) (not
> possible with every ScriptEngine, but NashornScriptEngine supplies this
> functionality).
>
> So we're effectively calling eval not at all, at least not permanently.
> Looking at the nashorn-stacktraces, though, all their calls are
> jdk.nashorn.internal.scripts.Script$\^eval\_._L[line
> number](<eval>:[another line number])
> I think it's just how they work internally. And to be honest, I'm not
> really sure if in our case the lone call to compile once is necessary,
> as a whole lot of optimization seems to only start happening when we
> start calling the scriptrunner and not when we create it.

if compile produces a new... let's say class, each time, then you get 
all the callsites and all the helper code new too. There might be 
internal compilation and optimization ongoing after compile, but it 
sounds to me as if nothing of that is going to be reused later, since 
you through the optimized result away. And next time, you start fresh.

bye blackdrag

-- 
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to