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 string-keyed map of json-like object graphs (IE: Json AST). I'm using JDK 1.6 and the embedded Rhinoscript engine (v1.6R2).
Currently, processing takes the form:
- Snippet is parsed to discover the names of referenced variables
- Variables are retrieved from the map and serialized to a json string
- Json string is assigned to a similarly named variable at the start of the script
- Evaluate augmented script
I'm trying to figure out how to skip the json serializing stage and create direct Rhinoscript native objects to place in the 'bindings' for the script. The desired steps would then be:
- Snippet is parsed to discover the names of referenced variables
- Variables are retrieved from the map and converted to native Rhinoscript equivalents
- Native objects are placed in bindings
- Evaluation of original script with said bindings
Do you know where I could find documentation or examples of how to instantiate native rhinoscript objects?
My scala learning project might be of some use if you want to tinker. And any answer I come up with should appear there too...
http://subversion.assembla.com/svn/freshcode_public/learn_scala/datastore/src/test/scala/pkg/script
Thanks in advance.