Last Comment Bug 692960 - Add Array.concat stub for concatenating two known dense arrays
: Add Array.concat stub for concatenating two known dense arrays
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla10
Assigned To: general
:
:
Mentors:
Depends on:
Blocks: 691314
  Show dependency treegraph
 
Reported: 2011-10-07 15:16 PDT by Brian Hackett (:bhackett)
Modified: 2011-10-19 03:14 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch against 15bfad783467 (15.46 KB, patch)
2011-10-07 15:16 PDT, Brian Hackett (:bhackett)
dvander: review+
Details | Diff | Splinter Review

Description Brian Hackett (:bhackett) 2011-10-07 15:16:06 PDT
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.
Comment 1 Brian Hackett (:bhackett) 2011-10-07 15:30:44 PDT
Uh, transpose '(old)' and '(new)' in comment 0.
Comment 2 Brian Hackett (:bhackett) 2011-10-18 11:25:00 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/c537139643a9
Comment 3 Marco Bonardo [::mak] 2011-10-19 03:14:55 PDT
https://hg.mozilla.org/mozilla-central/rev/c537139643a9

Note You need to log in before you can comment on or make changes to this bug.