Optimize property enumeration more
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox94 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(5 files)
On Google Sheets we spend a fair amount of time under Snapshot, called for for-in loops. We can optimize this better: in most cases the proto chain doesn't have any enumerable properties, so in that case we don't need to check for duplicates and iterate over all the prototype properties.
This also gets rid of some malloc lock contention for the duplicate-properties HashSet.
| Assignee | ||
Comment 1•4 years ago
|
||
This gives us the ability to check whether an object has only non-enumerable
properties in constant time. Prototype objects typically don't have enumerable
properties.
| Assignee | ||
Comment 2•4 years ago
|
||
Add a fast path to better optimize the common case where the proto chain has no
enumerable properties. The advantages of this are:
- We no longer have to iterate over all the properties on the proto chain.
- We don't need to check for duplicates (this involves a relatively slow HashSet and includes non-enumerable properties too).
ProtoMayHaveEnumerableProperties returns false (meaning the fast path works) in
97-100% of cases on typical web workloads.
Depends on D127054
| Assignee | ||
Comment 3•4 years ago
|
||
If we only care about enumerable properties and the object doesn't have any, we don't need
to iterate its properties.
We can't use this optimization in the CheckForDuplicates case, but fortunately the
optimization in the previous patch made that a lot less common.
Depends on D127055
| Assignee | ||
Comment 4•4 years ago
|
||
At least some of these were not covered by other jit-tests.
Depends on D127056
| Assignee | ||
Comment 5•4 years ago
|
||
Comment 7•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b64b97a7733b
https://hg.mozilla.org/mozilla-central/rev/474926a7192e
https://hg.mozilla.org/mozilla-central/rev/46ca817b5529
https://hg.mozilla.org/mozilla-central/rev/901076fcee17
https://hg.mozilla.org/mozilla-central/rev/5538d134615c
Description
•