Closed Bug 1386001 Opened 7 years ago Closed 7 years ago

Array.prototype.push often not inlined in Speedometer


(Core :: JavaScript Engine: JIT, defect, P1)




Performance Impact medium
Tracking Status
firefox57 --- wontfix
firefox58 --- fix-optional


(Reporter: anba, Unassigned)


(Blocks 1 open bug)


(Keywords: perf)

When doing a single run for each framework from InteractiveRunner.html and then counting calls to js::array_push (*), I got the following numbers:

Vanilla             36
Vanilla2015         35
Vanilla-babel       34
React               923
React-Redux         10855
Ember               47978
Backbone            3020
AngularJS           20106
Angular2            104
Vue                 512
jQuery              480
Preact              810
Inferno             133
Elm                 949
Flight              1432

At least for Ember this seems to be caused by not inlining array_push, because multiple arguments are passed to Array.prototype.push, but we only inline when exactly one argument is present (bug 966743). I've verified this by replacing all Array.prototype.push calls in ember/assets/vendor.js to use single-argument calls, i.e. I've replaced |array.push(x, y)| with |array.push(x); array.push(y);|. After that the number of non-inlined calls dropped to 4325 for Ember. I don't know if that's the same reason why Array.prototype.push isn't inlined more often for the other framework, though.

According to bug 1365361 array_push is called 4.5M times (built-in with the most calls and the second most ticks) (**).

(*) With gdb breakpoints, so may not be accurate to the single digit
(**) Of the subset of built-ins which were measured in bug 1365361.
Priority: -- → P1
Whiteboard: [qf:p2]
Keywords: perf
I thought Nicolas landed changes to Ion to inline calls to Array.push with multiple args.
Flags: needinfo?(nicolas.b.pierron)
(In reply to Kannan Vijayan [:djvj] from comment #1)
> I thought Nicolas landed changes to Ion to inline calls to Array.push with
> multiple args.

Yes, bug 966743 is supposed to have fixed that 3 months ago. (a month after opening this bug)
So, unless there is still an issue, we should mark this as a duplicate of bug 966743.
Closed: 7 years ago
Flags: needinfo?(nicolas.b.pierron)
Resolution: --- → DUPLICATE
Performance Impact: --- → P2
Whiteboard: [qf:p2]
You need to log in before you can comment on or make changes to this bug.