Hello everyone, I’m encountering some performance problems when running JS scripts in Sling and after looking at the Rhino script engine it seems that the engine does not cache the compiled version of the script being run. This means that for each JS source, the Rhino engine will compile the content into byte code, then execute it. Running does not usually incur much overhead for relatively small scripts - but compilation is a very expensive process.
Is there any way to avoid recompilation at each run, or is there something wrong with the scenario I’ve described above? I know Rhino provides two solutions to this: 1. Create an in-memory representation of the compiled script [0] 2. Use the dedicated compiler to generate a .class file [1] Can we leverage this to implement caching of JS scripts in Sling? All the best, Marius [0] http://www-archive.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context.html#compileReader(java.io.Reader, java.lang.String, int, java.lang.Object)<http://www-archive.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context.html#compileReader(java.io.Reader,%20java.lang.String,%20int,%20java.lang.Object)> [1] https://developer.mozilla.org/en/docs/Rhino/JavaScript_Compiler
