Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Issue 355663002: Optimize Map/Set.prototype.forEach (Closed)

Created:
6 years, 6 months ago by arv (Not doing code reviews)
Modified:
6 years, 6 months ago
Reviewers:
adamk, danno
CC:
v8-dev
Project:
v8
Visibility:
Public.

Description

Optimize Map/Set.prototype.forEach Instead of using an iterator result object and an entries array (for Map) we introduce a new runtime function that uses an array as an out param. On the Map ForEach perf test this leads to a 2.5x performance improvement. On the overall Map and Set tests this leads to a 18% and 13% improvement respectively. BUG=None LOG=Y R=danno@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=22027

Patch Set 1 #

Patch Set 2 : Use array as out param #

Patch Set 3 : Use same Next method for iterator next as well #

Patch Set 4 : Also get rid of NewIteratorResultObject since there are no more users of it #

Total comments: 1

Patch Set 5 : Cleanup #

Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -136 lines) Patch
M src/collection.js View 1 2 2 chunks +8 lines, -6 lines 0 comments Download
M src/collection-iterator.js View 1 2 3 4 2 chunks +35 lines, -2 lines 0 comments Download
M src/factory.h View 1 2 3 1 chunk +0 lines, -2 lines 0 comments Download
M src/factory.cc View 1 2 3 1 chunk +0 lines, -12 lines 0 comments Download
M src/objects.h View 1 2 4 chunks +29 lines, -12 lines 0 comments Download
M src/objects.cc View 1 2 2 chunks +55 lines, -90 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 1 chunk +30 lines, -0 lines 0 comments Download
M src/runtime.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/runtime.cc View 1 2 2 chunks +10 lines, -8 lines 0 comments Download
M test/mjsunit/runtime-gen/mapiteratornext.js View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M test/mjsunit/runtime-gen/setiteratornext.js View 1 2 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 10 (0 generated)
arv (Not doing code reviews)
Danno, Since the MapIterator.prototype.next and SetIterator.prototype.next always needs to generate a new array if the ...
6 years, 6 months ago (2014-06-24 22:18:53 UTC) #1
danno
On 2014/06/24 22:18:53, arv wrote: > Danno, > > Since the MapIterator.prototype.next and SetIterator.prototype.next always ...
6 years, 6 months ago (2014-06-24 23:00:42 UTC) #2
arv (Not doing code reviews)
On 2014/06/24 at 23:00:42, danno wrote: > I suspect this will be much faster than ...
6 years, 6 months ago (2014-06-24 23:06:23 UTC) #3
danno
On 2014/06/24 23:06:23, arv wrote: > On 2014/06/24 at 23:00:42, danno wrote: > > I ...
6 years, 6 months ago (2014-06-25 00:41:03 UTC) #4
arv (Not doing code reviews)
Use same Next method for iterator next as well
6 years, 6 months ago (2014-06-25 19:50:37 UTC) #5
arv (Not doing code reviews)
Also get rid of NewIteratorResultObject since there are no more users of it
6 years, 6 months ago (2014-06-25 19:58:16 UTC) #6
arv (Not doing code reviews)
Cleanup
6 years, 6 months ago (2014-06-25 20:13:45 UTC) #7
arv (Not doing code reviews)
This is now ready for another review. PTAL https://codereview.chromium.org/355663002/diff/60001/src/collection-iterator.js File src/collection-iterator.js (right): https://codereview.chromium.org/355663002/diff/60001/src/collection-iterator.js#newcode26 src/collection-iterator.js:26: var ...
6 years, 6 months ago (2014-06-25 20:17:54 UTC) #8
danno
I like this a lot. LGTM, I will land this for you. Thanks for the ...
6 years, 6 months ago (2014-06-25 23:27:40 UTC) #9
danno
6 years, 6 months ago (2014-06-26 00:41:10 UTC) #10
Message was sent while issue was closed.
Committed patchset #5 manually as r22027 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698