Closed Bug 692960 Opened 9 years ago Closed 9 years ago

Add Array.concat stub for concatenating two known dense arrays

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: bhackett1024, Unassigned)

References

Details

Attachments

(1 file)

Another behavior in PeaceKeeper 2.0's arrayCombined where we are absurdly slow compared to V8.  While there is ongoing work to add dense array paths to Array.concat (bug 609896), it will be faster yet to call a stub which just does a malloc + 2 memcpys.  This can only be done in limited circumstances (type effects of the call have been accounted for, statically known dense arrays, ...) so does not subsume other concat improvements.

With the attached patch:

function foo(x, y) {
  for (var i = 0; i < 500000; i++)
    x.concat(y);
}
var x = [];
var y = [];
for (var i = 0; i < 100; i++)
  y[i] = i;
foo(x, y);

js -m -n (old): 701
js -m -n (new): 3550
js -m -j -p: 2725
d8: 71

We still get clobbered by V8 here due to a combination of a lack of generational collection, allocating array buffers with malloc, and fat values.  Not really sure which, as tweaking the constants gives pretty nonlinear behavior.
Attachment #565668 - Flags: review?(dvander)
Blocks: 691314
Uh, transpose '(old)' and '(new)' in comment 0.
Attachment #565668 - Flags: review?(dvander) → review+
https://hg.mozilla.org/mozilla-central/rev/c537139643a9
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.