On 12 Feb., 14:45, Christophe Grand <[EMAIL PROTECTED]> wrote:
>
> Does someone have already profiled some (compiled) js code?
>

It's pretty easy to build a basic profiler (such as how much time was
spent in how many invocations of what function) using Rhino's debugger
interface. Just implement org.mozilla.javascript.debug.Debugger and
register an instance with Context.setDebugger() [1]. The Debugger
instance will then get notified when scripts/functions are entered and
left. All you have to do is collect/sort/output that data in whatever
way suits your needs.

http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Context.html#setDebugger(org.mozilla.javascript.debug.Debugger,%20java.lang.Object)

One downside is that it only works in interpreter mode, with the
compiler disabled. However, interpreter mode is not that much slower
than compiled mode, so it should be possible to use even in a
production environment.

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

Reply via email to