javascript - Java Scripting (jsr223): is it possible to (re)add the rhino compile feature -
oracle incuded stripped rhino in jdk6
one of stripped features rhino js bytecode compiler
is possible include @ application level?
id increase performance without changing jsr223 calls
i got working
basically need include rhino's org.mozilla.javascript.optimizer package.
however not easy dropping project, because oracle changed namespace of rhino implementation.
so have port package, includes tons of strings point wrong namespace (for class generation)
also needed inject optimizer internal rhino context:
class c = class.forname("sun.org.mozilla.javascript.internal.context"); field field = c.getdeclaredfield("codegenclass"); field.setaccessible(true); field.set(c, org.mozilla.javascript.optimizer.codegen.class); there 'auto inject' way - rhinos context class automatically expects codegen class in specific package - depends on oracle port of context class, didn't find sources..
but apporoach has big downside:
the codegen port targets specific rhino version , may not work on vm versions or may break on vm update
so dropped jsr233 api , used rhino directly library. experienced big performance increase - expect jsr233 api adds lot of overhead js invocations.
Comments
Post a Comment