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

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

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

Description

Optimize Map/Set.prototype.forEach Instead of using an iterator result object and an entries array (for Map) we call multiple runtime functions that returns the values without wrapping them in temporary objects. This gives a 85% performance increase for Map.prototype.forEach as well as 13% and 8% perf increase overall on the Map and Set tests. BUG=None LOG=Y

Patch Set 1 #

Patch Set 2 : More cleanup #

Patch Set 3 : Add the runtime-gen files #

Total comments: 6

Patch Set 4 : Unhandlify #

Total comments: 6

Patch Set 5 : It all makes sense now #

Patch Set 6 : Update count to fix merge issue #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -75 lines) Patch
M src/collection.js View 1 2 chunks +12 lines, -6 lines 2 comments Download
M src/objects.h View 1 2 3 4 5 4 chunks +27 lines, -8 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 5 chunks +67 lines, -52 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 1 chunk +19 lines, -0 lines 0 comments Download
M src/runtime.h View 1 2 3 4 5 2 chunks +7 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 2 3 4 5 2 chunks +58 lines, -0 lines 0 comments Download
A + test/mjsunit/runtime-gen/mapiteratorcurrentkey.js View 1 2 1 chunk +1 line, -1 line 0 comments Download
A + test/mjsunit/runtime-gen/mapiteratorcurrentvalue.js View 1 2 1 chunk +1 line, -1 line 0 comments Download
A + test/mjsunit/runtime-gen/mapiteratorhasmore.js View 2 1 chunk +1 line, -1 line 0 comments Download
A + test/mjsunit/runtime-gen/mapiteratormovenext.js View 2 1 chunk +1 line, -1 line 0 comments Download
A + test/mjsunit/runtime-gen/setiteratorcurrentkey.js View 1 2 1 chunk +1 line, -1 line 0 comments Download
A + test/mjsunit/runtime-gen/setiteratorhasmore.js View 2 1 chunk +1 line, -1 line 0 comments Download
A + test/mjsunit/runtime-gen/setiteratormovenext.js View 2 1 chunk +1 line, -1 line 0 comments Download
M tools/generate-runtime-tests.py View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
arv (Not doing code reviews)
Add the runtime-gen files
6 years, 6 months ago (2014-06-11 18:42:31 UTC) #1
arv (Not doing code reviews)
PTAl
6 years, 6 months ago (2014-06-11 18:50:26 UTC) #2
adamk
https://codereview.chromium.org/329253004/diff/40001/src/objects-inl.h File src/objects-inl.h (right): https://codereview.chromium.org/329253004/diff/40001/src/objects-inl.h#newcode6963 src/objects-inl.h:6963: TableType* table(TableType::cast(iterator->table())); The use of a raw pointer in ...
6 years, 6 months ago (2014-06-16 20:37:46 UTC) #3
arv (Not doing code reviews)
Unhandlify
6 years, 6 months ago (2014-06-16 21:28:35 UTC) #4
arv (Not doing code reviews)
All done https://codereview.chromium.org/329253004/diff/40001/src/objects-inl.h File src/objects-inl.h (right): https://codereview.chromium.org/329253004/diff/40001/src/objects-inl.h#newcode6963 src/objects-inl.h:6963: TableType* table(TableType::cast(iterator->table())); On 2014/06/16 20:37:46, adamk wrote: ...
6 years, 6 months ago (2014-06-16 21:57:21 UTC) #5
adamk
More handlification comments... https://codereview.chromium.org/329253004/diff/50001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/329253004/diff/50001/src/objects.cc#newcode16436 src/objects.cc:16436: bool OrderedHashTableIterator<Derived, TableType>::HasMore( On second reading, ...
6 years, 6 months ago (2014-06-16 22:13:57 UTC) #6
arv (Not doing code reviews)
https://codereview.chromium.org/329253004/diff/50001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/329253004/diff/50001/src/objects.cc#newcode16436 src/objects.cc:16436: bool OrderedHashTableIterator<Derived, TableType>::HasMore( On 2014/06/16 22:13:57, adamk wrote: > ...
6 years, 6 months ago (2014-06-16 23:53:09 UTC) #7
arv (Not doing code reviews)
It all makes sense now
6 years, 6 months ago (2014-06-17 16:52:40 UTC) #8
arv (Not doing code reviews)
Update count to fix merge issue
6 years, 6 months ago (2014-06-17 16:58:55 UTC) #9
arv (Not doing code reviews)
PTAL
6 years, 6 months ago (2014-06-17 18:00:04 UTC) #10
adamk
lgtm, hopefully my advice matches current v8 practice :)
6 years, 6 months ago (2014-06-18 17:09:29 UTC) #11
arv (Not doing code reviews)
Michael, can you also take a look? Thanks.
6 years, 6 months ago (2014-06-18 18:22:56 UTC) #12
arv (Not doing code reviews)
Adding Andreas since Michael is not responding.
6 years, 6 months ago (2014-06-23 19:10:52 UTC) #13
Michael Starzinger
Handing off to either Andreas or Danno. https://codereview.chromium.org/329253004/diff/90001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/329253004/diff/90001/src/collection.js#newcode87 src/collection.js:87: %SetIteratorMoveNext(iterator); I ...
6 years, 6 months ago (2014-06-23 19:51:52 UTC) #14
arv (Not doing code reviews)
In the long run we should find a way to optimize away objects that are ...
6 years, 6 months ago (2014-06-23 20:31:52 UTC) #15
danno
On 2014/06/23 19:51:52, Michael Starzinger wrote: > Handing off to either Andreas or Danno. > ...
6 years, 6 months ago (2014-06-23 20:47:27 UTC) #16
arv (Not doing code reviews)
On 2014/06/23 at 20:47:27, danno wrote: > On 2014/06/23 19:51:52, Michael Starzinger wrote: > > ...
6 years, 6 months ago (2014-06-23 21:00:04 UTC) #17
danno
On 2014/06/23 21:00:04, arv wrote: > On 2014/06/23 at 20:47:27, danno wrote: > > On ...
6 years, 6 months ago (2014-06-23 22:04:39 UTC) #18
danno
On 2014/06/23 22:04:39, danno wrote: > On 2014/06/23 21:00:04, arv wrote: > > On 2014/06/23 ...
6 years, 6 months ago (2014-06-23 23:25:45 UTC) #19
danno
On 2014/06/23 23:25:45, danno wrote: > On 2014/06/23 22:04:39, danno wrote: > > On 2014/06/23 ...
6 years, 6 months ago (2014-06-24 16:54:00 UTC) #20
arv (Not doing code reviews)
6 years, 6 months ago (2014-06-24 22:40:24 UTC) #21
I'm closing this CL in favor of https://codereview.chromium.org/355663002/

Powered by Google App Engine
This is Rietveld 408576698