Closed Bug 1420462 Opened 2 years ago Closed 2 years ago

Add a EnumerableOwnProperties fast path for unboxed objects

Categories

(Core :: JavaScript: Standard Library, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: anba, Assigned: jandem)

Details

Attachments

(1 file)

bug 1406095 added a fast path for native objects to EnumerableOwnProperties, a similar fast path should be added for unboxed objects (see bug 1406095, comment #2).
Attached patch PatchSplinter Review
This handles the no-expando-props case. I added some logging and this hits >40,000 times when running all Speedometer tests once. The expando case doesn't show up and is a lot more complicated to support.

I also added unboxedObjectsEnabled() and isUnboxedObject(o) shell functions, to make tests a bit more robust.
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Attachment #8936693 - Flags: review?(andrebargull)
I forgot my micro-benchmark:

before: 263 ms
after:  154 ms

---

function Obj(x, y) {
    this.x = x;
    this.y = y;
}
function test() {
    var arr = [];
    for (var i = 0; i < 100; i++) {
        arr.push(new Obj(i, i + 1));
    }
    var t = new Date;
    for (var i = 0; i < 1000000; i++) {
        keys = Object.keys(arr[60]);
        values = Object.values(arr[60]);
    }
    print(new Date - t);
}
test();
Comment on attachment 8936693 [details] [diff] [review]
Patch

Review of attachment 8936693 [details] [diff] [review]:
-----------------------------------------------------------------

Not supporting the expando case seems reasonable to me when considering the additional code necessary for it.
Attachment #8936693 - Flags: review?(andrebargull) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0b42ea549d67
Add an EnumerableOwnProperties fast path for unboxed objects. r=anba
https://hg.mozilla.org/mozilla-central/rev/0b42ea549d67
https://hg.mozilla.org/mozilla-central/rev/5d203926da51
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.