Stefan Weiss wrote:
Hi.

I'm relatively new to Rhino, and I've noticed that the first time a
certain JS function is executed, it's rather slow, but repeated calls
are getting faster:

(init: 162 ms)
(eval JSLint source: 370 ms)
invoke JSLINT(): 2944 ms
invoke JSLINT(): 1518 ms
invoke JSLINT(): 571 ms
invoke JSLINT(): 418 ms
invoke JSLINT(): 451 ms
invoke JSLINT(): 419 ms
invoke JSLINT(): 404 ms
invoke JSLINT(): 406 ms
invoke JSLINT(): 388 ms
invoke JSLINT(): 381 ms

This curve tells me that some kind of cache or optimization is kicking
in, and I'm wondering what it is. Is it inherent in Rhino? Is it the
JVM? Or some kind of reuse of memory structures?

It is the JIT compiler in the JVM that has started to compile bytecode into native code.

AFAIK, there is no JIT compiler in Rhino, at least not in the version
included in Java 6 SE, and Sun's guide [0] says that "JavaScript-to-
bytecode compilation (also called 'optimizer')" has been excluded in
their version.

Rhino is implemented in Java. Thus it is compiled into byte code, which is then JIT compiled to native code.

Jyrki

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to