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

Issue 12213010: New implementation of {,Linked}Hash{Set,Map}. (Closed)

Created:
7 years, 10 months ago by Lasse Reichstein Nielsen
Modified:
7 years, 10 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

New implementation of {,Linked}Hash{Set,Map}. Accepts null keys/entries. Much faster LinkedHashMap, faster HashSet, slight penalty on HashMap, possibly due to accepting null keys. Performance difference depends on table size. Committed: https://code.google.com/p/dart/source/detail?r=18437

Patch Set 1 #

Patch Set 2 : Now with new files too #

Total comments: 73

Patch Set 3 : Address review comments, fix bugs. #

Total comments: 10

Patch Set 4 : Fix some comments. Will add more tests #

Patch Set 5 : Do capacity checks after adding, not before. Don't break iterators if nothing is added. #

Patch Set 6 : Add tests. Fix bugs. #

Patch Set 7 : Made null elements work again, added tests for null. #

Total comments: 1

Patch Set 8 : Fixed copyright statments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1601 lines, -599 lines) Patch
M sdk/lib/_internal/compiler/implementation/js_backend/backend.dart View 1 2 3 4 5 6 7 4 chunks +6 lines, -6 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/native_handler.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/source_map_builder.dart View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M sdk/lib/collection/collection.dart View 1 2 1 chunk +6 lines, -2 lines 0 comments Download
M sdk/lib/collection/collection_sources.gypi View 1 chunk +6 lines, -2 lines 0 comments Download
A sdk/lib/collection/hash_map.dart View 1 2 3 4 5 6 7 1 chunk +116 lines, -0 lines 0 comments Download
A sdk/lib/collection/hash_set.dart View 1 2 3 4 5 6 7 1 chunk +113 lines, -0 lines 0 comments Download
A sdk/lib/collection/hash_table.dart View 1 2 3 4 5 6 7 1 chunk +411 lines, -0 lines 0 comments Download
A sdk/lib/collection/linked_hash_map.dart View 1 2 3 4 5 6 7 1 chunk +121 lines, -0 lines 0 comments Download
A sdk/lib/collection/linked_hash_set.dart View 1 2 3 4 5 6 7 1 chunk +155 lines, -0 lines 0 comments Download
A sdk/lib/collection/linked_hash_table.dart View 1 2 3 4 5 6 7 1 chunk +165 lines, -0 lines 0 comments Download
D sdk/lib/collection/map.dart View 1 chunk +0 lines, -474 lines 0 comments Download
D sdk/lib/collection/set.dart View 1 chunk +0 lines, -110 lines 0 comments Download
M sdk/lib/core/map.dart View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M sdk/lib/io/http_impl.dart View 1 2 3 4 5 6 1 chunk +3 lines, -2 lines 0 comments Download
M tests/co19/co19-dart2dart.status View 1 2 3 4 5 6 1 chunk +18 lines, -0 lines 0 comments Download
M tests/co19/co19-dart2js.status View 1 2 3 4 5 6 7 1 chunk +18 lines, -0 lines 0 comments Download
M tests/co19/co19-runtime.status View 1 2 3 4 5 6 1 chunk +18 lines, -0 lines 0 comments Download
A tests/corelib/hash_map2_test.dart View 1 2 3 4 5 6 7 1 chunk +231 lines, -0 lines 0 comments Download
A tests/corelib/hash_set_test.dart View 1 2 3 4 5 6 7 1 chunk +206 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
Lasse Reichstein Nielsen
7 years, 10 months ago (2013-02-05 09:32:49 UTC) #1
kasperl
On 2013/02/05 09:32:49, Lasse Reichstein Nielsen wrote: You should upload the new files too.
7 years, 10 months ago (2013-02-05 09:42:00 UTC) #2
Lasse Reichstein Nielsen
Thanks :) I'll create co19 issue numbers when I'm good to commit.
7 years, 10 months ago (2013-02-05 11:50:09 UTC) #3
erikcorry
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode40 sdk/lib/collection/hash_map.dart:40: _modificationCount++; You probably want to mask this with something ...
7 years, 10 months ago (2013-02-05 16:25:05 UTC) #4
Lasse Reichstein Nielsen
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode40 sdk/lib/collection/hash_map.dart:40: _modificationCount++; That could be wrong, if you keep an ...
7 years, 10 months ago (2013-02-05 19:47:40 UTC) #5
sra1
I like the approach take here. However, I'm concerned that this change causes a 29k ...
7 years, 10 months ago (2013-02-06 05:35:21 UTC) #6
floitsch
LGTM. I would prefer not to share the same array for keys and values. It ...
7 years, 10 months ago (2013-02-06 10:43:58 UTC) #7
erikcorry
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode53 sdk/lib/collection/hash_map.dart:53: _setValue(offset, value); On 2013/02/05 19:47:40, Lasse Reichstein Nielsen wrote: ...
7 years, 10 months ago (2013-02-06 10:57:55 UTC) #8
floitsch
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode53 sdk/lib/collection/hash_map.dart:53: _setValue(offset, value); On 2013/02/05 19:47:40, Lasse Reichstein Nielsen wrote: ...
7 years, 10 months ago (2013-02-06 11:45:46 UTC) #9
erikcorry
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_table.dart File sdk/lib/collection/hash_table.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_table.dart#newcode115 sdk/lib/collection/hash_table.dart:115: while (true) { On 2013/02/06 11:45:46, floitsch wrote: > ...
7 years, 10 months ago (2013-02-06 11:48:41 UTC) #10
sra1
What is the idiomatic way retrieve an element from a map and return a call-site ...
7 years, 10 months ago (2013-02-06 17:01:08 UTC) #11
Lasse Reichstein Nielsen
Please take another look at the concurrent-modification handling. Nicolas: FYI, I added some wrappers in ...
7 years, 10 months ago (2013-02-08 13:53:01 UTC) #12
floitsch
LGTM except for the _NULL == part. https://codereview.chromium.org/12213010/diff/14001/sdk/lib/collection/hash_set.dart File sdk/lib/collection/hash_set.dart (right): https://codereview.chromium.org/12213010/diff/14001/sdk/lib/collection/hash_set.dart#newcode68 sdk/lib/collection/hash_set.dart:68: _table._recordModification(); shouldn't ...
7 years, 10 months ago (2013-02-08 16:48:35 UTC) #13
erikcorry
In an earlier iteration I pointed out a bug that was getting past your tests, ...
7 years, 10 months ago (2013-02-11 10:18:29 UTC) #14
Lasse Reichstein Nielsen
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode53 sdk/lib/collection/hash_map.dart:53: _setValue(offset, value); Gah! Ok. I think I can do ...
7 years, 10 months ago (2013-02-11 14:07:37 UTC) #15
floitsch
https://codereview.chromium.org/12213010/diff/14001/sdk/lib/collection/hash_table.dart File sdk/lib/collection/hash_table.dart (right): https://codereview.chromium.org/12213010/diff/14001/sdk/lib/collection/hash_table.dart#newcode10 sdk/lib/collection/hash_table.dart:10: bool operator ==(Object other) => other == null || ...
7 years, 10 months ago (2013-02-11 14:09:43 UTC) #16
erikcorry
https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode53 sdk/lib/collection/hash_map.dart:53: _setValue(offset, value); On 2013/02/11 14:07:37, Lasse Reichstein Nielsen wrote: ...
7 years, 10 months ago (2013-02-11 14:42:05 UTC) #17
Lasse Reichstein Nielsen
PTAL https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart File sdk/lib/collection/hash_map.dart (right): https://codereview.chromium.org/12213010/diff/2001/sdk/lib/collection/hash_map.dart#newcode53 sdk/lib/collection/hash_map.dart:53: _setValue(offset, value); Yes, That's acceptable. You always get ...
7 years, 10 months ago (2013-02-12 10:34:47 UTC) #18
erikcorry
7 years, 10 months ago (2013-02-12 14:31:12 UTC) #19
LGTM

https://codereview.chromium.org/12213010/diff/8024/tests/corelib/hash_map2_te...
File tests/corelib/hash_map2_test.dart (right):

https://codereview.chromium.org/12213010/diff/8024/tests/corelib/hash_map2_te...
tests/corelib/hash_map2_test.dart:1: // Copyright (c) 2011, the Dart project
authors.  Please see the AUTHORS file
2013

Powered by Google App Engine
This is Rietveld 408576698