Closed Bug 561701 Opened 14 years ago Closed 14 years ago

Investigate why V8 is faster than TM on empty loop

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 501189

People

(Reporter: cdleary, Unassigned)

Details

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.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.