Closed
Bug 692847
Opened 13 years ago
Closed 13 years ago
Speed up Array.shift, and Array.{pop,shift} on empty arrays
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla10
People
(Reporter: bhackett1024, Assigned: bhackett1024)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
12.62 KB,
patch
|
dvander
:
review+
|
Details | Diff | Splinter Review |
Peacekeeper 2.0's arrayCombine test is broken and does many of its operations on an empty array, with a bunch of pop and shift calls costing the most. V8 has a fast path for pop() on an empty array, so I don't feel too bad benchmark-gaming this one. Attached patch allows the pop() inline path to handle empty arrays (only when the call is known to produce undefined), and generalizes this path to also handle shift() (which calls a stub to memmove() in the non-empty case). This gives a good speedup to non-empty shift() too: function foo(x) { for (var i = 0; i < 10; i++) x.push(i); for (var i = 0; i < 10000000; i++) x.push(x.shift()); } foo([]); js -m -n (old): 625 js -m -n (new): 322 js -m -j -p: 805 d8: 592
Attachment #565575 -
Flags: review?(dvander)
Comment 1•13 years ago
|
||
Brian, I get an error about ‘js::mjit::Assembler::storeValueFromComponents(JSValueType&, JSC::X86Registers::RegisterID, JSC::AbstractMacroAssembler<JSC::X86Assembler>::Address&) not being defined when I build this on top of rev 15bfad783467. This is in a 64-bit build. A 32-bit build works fine.
Assignee | ||
Comment 2•13 years ago
|
||
Oops, was missing a coercion that was necessary on x64.
Assignee: general → bhackett1024
Attachment #565575 -
Attachment is obsolete: true
Attachment #565575 -
Flags: review?(dvander)
Attachment #565591 -
Flags: review?(dvander)
Updated•13 years ago
|
Attachment #565591 -
Flags: review?(dvander) → review+
Assignee | ||
Comment 3•13 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/882404096d65
Comment 4•13 years ago
|
||
As an aside, according to https://bugzilla.mozilla.org/show_bug.cgi?id=499198#c32 Peacekeeper doesn't do a bunch of operations on empty arrays any more, in arrayCombined.
Comment 5•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/882404096d65
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in
before you can comment on or make changes to this bug.
Description
•