Are there any strategies for speeding up the loadi...
# scripting
e
Are there any strategies for speeding up the loading of scripts when embedding the script host using
BasicJvmScriptingHost
and
dependenciesFromCurrentContext(wholeClasspath = true)
and one repeatedly loads the same script with small changes?
i
The current script compiler implementation is not designed to share anything. So, only some indirect measures may help for now, e.g. reducing classpath, i.e. not using wholeClasspath, but only specific jars. You can try to use REPL instead (e.g. via JSR-223), the compiler (for the context) there keeps state between evaluations. But you may get clashes there, and there is some memory cost as well. But in some scenarios it might work.
e
Thanks Ilya. Are there any tools for adding jars using regexp matching in place?
Also, from a cursory test it seems that JSR-223 vs using
BasicJvmScriptingHost
the latter is actually a bit faster. I use both by creating new scripting engines for every instance. (https://github.com/openrndr/orx/blob/master/orx-olive/src/main/kotlin/ScriptObjectLoaderJSR233.kt vs https://github.com/openrndr/orx/blob/master/orx-olive/src/main/kotlin/ScriptObjectLoaderKSH.kt)
i
Are there any tools for adding jars using regexp matching in place?
No, unfortunately not. But seems easy to do in the configurator using
updateClasspath
call.
For every engine - yes. I meant evaluate the script on the same engine.
e
that's clear, will do some benchmarking here
i
Please, share the results afterwards.
e
­čĹî