Add Array.concat stub for concatenating two known dense arrays

RESOLVED FIXED in mozilla10

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: bhackett, Unassigned)

Tracking

unspecified
mozilla10
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 565668 [details] [diff] [review]
patch against 15bfad783467

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)
(Reporter)

Updated

6 years ago
Blocks: 691314
(Reporter)

Comment 1

6 years ago
Uh, transpose '(old)' and '(new)' in comment 0.
Attachment #565668 - Flags: review?(dvander) → review+
(Reporter)

Comment 2

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/c537139643a9
https://hg.mozilla.org/mozilla-central/rev/c537139643a9
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.