I came across this while writing a templating engine for Helma.

"js.jar" is built from a fresh cvs.mozilla.org checkout,
"js-noxmlbeams.jar" is the same without
org/mozilla/javascript/xml/impl/xmlbeans/ (thus using
.../javascript/xmlimpl/), "js" is spidermonkey 1.8, java is j2se6,
time is in msecs:

[EMAIL PROTECTED]:/tmp/w/seethrough_helma$ java -Djava.compiler=NONE -jar
js.jar -opt 9 e4x_bm.js
times per run: 10000
run #0 total time: 42596
run #1 total time: 48355
run #2 total time: 51056
run #3 total time: 52297
[EMAIL PROTECTED]:/tmp/w/seethrough_helma$ java -Djava.compiler=NONE -jar js-
noxmlbeans.jar -opt 9 e4x_bm.js
times per run: 10000
run #0 total time: 38487
run #1 total time: 45523
run #2 total time: 43726
run #3 total time: 46889
[EMAIL PROTECTED]:/tmp/w/seethrough_helma$ js e4x_bm.js
times per run: 10000
run #0 total time: 18
run #1 total time: 6
run #2 total time: 19
run #3 total time: 6
[EMAIL PROTECTED]:/tmp/w/seethrough_helma$ cat e4x_bm.js
function bm(fn, times) {
    times=times||100;
    var start=Date.now();
    for(var i=0;i<times;i++)
        fn();
    return (Date.now() - start);
}

var runs = 4;
var times = 10000;

print('times per run: ' + times);

for(var i=0;i<runs; i++) {
    var total = bm(function(){ <test/> }, times);
    print('run #' + i + ' total time: ' + total);
}
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to