Closed
Bug 1380111
Opened 9 years ago
Closed 9 years ago
Inline iterator code into Map/Set.prototype.forEach
Categories
(Core :: JavaScript: Standard Library, enhancement)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
mozilla56
| Tracking | Status | |
|---|---|---|
| firefox56 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
Details
Attachments
(1 file, 1 obsolete file)
|
3.66 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
With bug 1380087, this patch seems to improve Map.prototype.forEach quite a bit.
Improves from 480ms (tip) to 150ms:
var m = new Map(Array(100).fill(0).map((v, k) => [k + 1, null]));
var q = 0;
function fn(v, k) { q += k; }
var t = Date.now();
for (var i = 0; i < 100000; ++i) {
m.forEach(fn);
}
print([Date.now() - t, q);
Improves from 160ms (bug 1380087) to 130ms for me:
var s = new Set(Array(100).fill(0).map((v, k) => k + 1));
var q = 0;
function fn() { ++q; }
var t = Date.now();
for (var i = 0; i < 100000; ++i) {
s.forEach(fn);
}
print(Date.now() - t, q);
| Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8885418 -
Flags: review?(till)
Comment 2•9 years ago
|
||
Comment on attachment 8885418 [details] [diff] [review]
bug1380111.patch
Review of attachment 8885418 [details] [diff] [review]:
-----------------------------------------------------------------
Nice, r=me
::: js/src/builtin/Set.js
@@ +37,5 @@
> var values = callFunction(std_Set_iterator, S);
> +
> + // Inlined: SetIteratorNext
> + var setIterationResult = setIteratorTemp.setIterationResult;
> + if (!setIterationResult) {
style nit: no braces needed
Attachment #8885418 -
Flags: review?(till) → review+
| Assignee | ||
Comment 3•9 years ago
|
||
Addressed review comments, carrying r+.
Attachment #8885418 -
Attachment is obsolete: true
Attachment #8885835 -
Flags: review+
| Assignee | ||
Comment 4•9 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3cff2827909ce0abd19b1968ed7ffcf941469cd1
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/bed95eec1188
Inline iterator code into Map/Set forEach to avoid extra allocations. r=till
Keywords: checkin-needed
Comment 6•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•