I\'m trying to improve the performance of a javascript snippet evaluator. These script snippets can reference any number of variables that exist in a strin
So after much fiddling I've come up with an adequate solution although it did not yield the performance increase I had hoped for (only 10% faster).
The solution is specific to Scala / Lift / Json and is contained in the ScriptingUtil.scala file.
To summarise:
java.lang.RuntimeException: No Context associated with current Thread
)Scriptable
is needed. The solution I came up with isn't pretty but it works.To create a NativeArray:
val na = new NativeArray(arr)
na.setPrototype(ScriptableObject.getClassPrototype(scope, "Array"))