Hi,
We're testing how to integrate JS Rhino into our webapp in order to
allow customers to write custom server-side code. Because this will be
outside the control of developers, we need to run the scripts in a
sandbox. However, during testing we hit a problem on instruction
counts.
It seemed that 2 calls to the function below counted for roughly 5000
instructions each.
function setIfNotEquals(ref, amount) {
var str = inter.getValue(ref);
var val = parseInt(str);
if (val != amount) {
inter.setValue(ref, amount);
inter.throwError(ref, "Not equal);
}
}
inter is an interface into the rest of the webapp (i.e. a Java Object)
and ref is a database reference.
My questions are:
- What does Rhino use to calculate its instruction count? Is its the
number of JavaScript instructions, JVM instructions or something else?
- Do library calls count towards the instruction count? i.e. does
parseInt() and inter.setValue() increase the count
- Where can I find documentation about instruction counts?
Sorry to be asking this here, but the API reference (http://
www.mozilla.org/rhino/apidocs/) seems to be down and I haven't found
an answer in the documentation or from searching the web.
Thank you in advance :)
- Josh