Inquiry stemming from http://ugh.cc/ubench-ironjs-f-jit-vs-v8-vs-tracemonkey/ When the empty loop is placed in the global scope TM is faster: $ bench_shells.py 'for (var i = 0; i < 10000000; ++i);' --global-scope Run count: 50 v8: 89.22 (+/- 3.34) tm: 32.36 (+/- 7.27) But in a benchmark-function scope V8 is faster: $ bench_shells.py 'for (var i = 0; i < 10000000; ++i);' Run count: 50 v8: 23.2 (+/- 1.28) tm: 30.46 (+/- 0.70) (Bench shells is just a little shortcut script I wrote: http://gist.github.com/379010 )
Forgot to mention: bleeding edge V8 x64 rev 4486, TM x64 rev 41264.
dmandelin looked into empty loops before. Basically this is caused by a lack of register allocation across the loop edge and the operationCallback check at the loop end. Both effects become much less relevant for non-empty loops, or the "real world", as one might also call it.
(In reply to comment #2) I see that now: bug 501189 and attachment 390586 [details]. Auxiliary reference: https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_SetOperationCallback#section_3 Marking as dup.