Closed
Bug 1500052
Opened 7 years ago
Closed 7 years ago
Iterator cache should check initialized length instead of empty elements singleton
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla64
| Tracking | Status | |
|---|---|---|
| firefox64 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file)
Instead of checking hasEmptyElements() we should check getDenseInitializedLength() == 0. This eliminates thousands of iterator objects on Google Docs (I noticed this while looking into bug 505818 comment 18).
The patch improves the micro-benchmark below a lot:
before: 13575 ms
after: 170 ms
function f() {
var a = new Array(10);
var t = new Date;
for (var i = 0; i < 10000000; i++) {
for (var x in a) {}
}
print(new Date - t);
}
f();
| Assignee | ||
Comment 1•7 years ago
|
||
hasEmptyElements() is too pessimistic: arrays often have no elements but aren't
using the empty elements singleton.
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/609976e5c798
Fix iterator cache to check getDenseInitializedLength() == 0 instead of hasEmptyElements(). r=evilpie
Comment 3•7 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•