Closed Bug 1056795 Opened 10 years ago Closed 10 years ago

Optimize ArrayPushDense

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
jit::ArrayPushDense is the slow path for inlined Array.push calls. It forwards to js::array_push, but that function is too generic/slow. On Octane-deltablue we spend about 5% under ArrayPushDense.

The attached patch adds a fast path to jit::ArrayPushDense. It improves the micro-benchmark below from 894 to 715 ms and wins at least a few hundred points on deltablue.

Now with GGC we could also add a JitCode stub to handle reallocating/copying the elements without any VM calls, but that's a lot more work and this is a very easy win for now.

function f() {
    var t = new Date;
    for (var i=0; i<1000000; i++) {
	var arr = [];
	for (var j=0; j<130; j++)
	    arr.push(j);
    }
    print(new Date - t);
}
f();
Attachment #8476662 - Flags: review?(bhackett1024)
Attachment #8476662 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/a4877238de09
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Depends on: 1060398
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: