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

Issue 9186035: Use hash map for event handler file descriptor map (Closed)

Created:
8 years, 11 months ago by Søren Gjesse
Modified:
8 years, 11 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Use hash map for event handler file descriptor map Instead of using an array indexed using the file descriptor for looking up data associated with a socket (SocketData objects) this is now stored in a hash map using the file descriptor as key. Added hash map implementation like the one used in the V8 project. R=ager@google.com, whesse@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=3483

Patch Set 1 #

Patch Set 2 : Minor fixes #

Total comments: 9

Patch Set 3 : Addressed review comments from iposva@ #

Patch Set 4 : Rebased to r3337 #

Patch Set 5 : Fixed accidental change in rebase #

Patch Set 6 : Addressed shared utils.h issue #

Total comments: 2

Patch Set 7 : Also change this for Mac OS #

Total comments: 4

Patch Set 8 : Addressed comments by ager@ #

Total comments: 23

Patch Set 9 : Addressed review comments from whesse@ and iposva@ #

Total comments: 8

Patch Set 10 : Addressed review comments from iposva@ #

Patch Set 11 : Rebased to r3482 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+563 lines, -89 lines) Patch
M runtime/bin/builtin_sources.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/bin/eventhandler_linux.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +10 lines, -4 lines 0 comments Download
M runtime/bin/eventhandler_linux.cc View 1 2 3 4 5 6 7 8 9 8 chunks +44 lines, -37 lines 0 comments Download
M runtime/bin/eventhandler_macos.h View 1 2 3 4 5 6 7 8 9 10 6 chunks +12 lines, -4 lines 0 comments Download
M runtime/bin/eventhandler_macos.cc View 1 2 3 4 5 6 7 8 9 8 chunks +44 lines, -37 lines 0 comments Download
A runtime/bin/hashmap.h View 1 2 3 4 5 6 7 8 9 1 chunk +76 lines, -0 lines 0 comments Download
A runtime/bin/hashmap.cc View 1 2 3 4 5 6 7 8 9 1 chunk +190 lines, -0 lines 0 comments Download
A runtime/bin/hashmap_test.cc View 1 2 3 4 5 6 7 8 9 1 chunk +169 lines, -0 lines 0 comments Download
M runtime/platform/utils.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/src/ProcessStderrTest.dart View 3 chunks +7 lines, -3 lines 0 comments Download
M tests/standalone/src/ProcessStdoutTest.dart View 3 chunks +7 lines, -3 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
Søren Gjesse
8 years, 11 months ago (2012-01-12 15:25:02 UTC) #1
Mads Ager (chromium)
I think we should shared PowerOf2 and hash functions between the components in platform/utils.h as ...
8 years, 11 months ago (2012-01-13 13:33:16 UTC) #2
Søren Gjesse
http://codereview.chromium.org/9186035/diff/2001/runtime/bin/hashmap.cc File runtime/bin/hashmap.cc (right): http://codereview.chromium.org/9186035/diff/2001/runtime/bin/hashmap.cc#newcode36 runtime/bin/hashmap.cc:36: if (occupancy_ + occupancy_/4 >= capacity_) { On 2012/01/13 ...
8 years, 11 months ago (2012-01-13 14:51:23 UTC) #3
Ivan Posva
http://codereview.chromium.org/9186035/diff/2001/runtime/bin/hashmap.h File runtime/bin/hashmap.h (right): http://codereview.chromium.org/9186035/diff/2001/runtime/bin/hashmap.h#newcode20 runtime/bin/hashmap.h:20: explicit HashMap(MatchFun match = &SamePointerValue, Is explicit needed here?
8 years, 11 months ago (2012-01-14 01:19:02 UTC) #4
Søren Gjesse
Now using shared PowerOfTwo and WorkHash from platform/utils.h http://codereview.chromium.org/9186035/diff/2001/runtime/bin/hashmap.h File runtime/bin/hashmap.h (right): http://codereview.chromium.org/9186035/diff/2001/runtime/bin/hashmap.h#newcode20 runtime/bin/hashmap.h:20: explicit ...
8 years, 11 months ago (2012-01-16 14:14:58 UTC) #5
Mads Ager (google)
LGTM http://codereview.chromium.org/9186035/diff/21001/runtime/bin/hashmap.cc File runtime/bin/hashmap.cc (right): http://codereview.chromium.org/9186035/diff/21001/runtime/bin/hashmap.cc#newcode161 runtime/bin/hashmap.cc:161: abort(); Maybe we should use the FATAL macro ...
8 years, 11 months ago (2012-01-16 14:23:48 UTC) #6
Søren Gjesse
http://codereview.chromium.org/9186035/diff/21001/runtime/bin/hashmap.cc File runtime/bin/hashmap.cc (right): http://codereview.chromium.org/9186035/diff/21001/runtime/bin/hashmap.cc#newcode161 runtime/bin/hashmap.cc:161: abort(); On 2012/01/16 14:23:48, Mads Ager wrote: > Maybe ...
8 years, 11 months ago (2012-01-16 16:18:08 UTC) #7
Bill Hesse
LGTM. http://codereview.chromium.org/9186035/diff/17002/runtime/bin/eventhandler_macos.cc File runtime/bin/eventhandler_macos.cc (right): http://codereview.chromium.org/9186035/diff/17002/runtime/bin/eventhandler_macos.cc#newcode385 runtime/bin/eventhandler_macos.cc:385: return dart::Utils::WordHash(fd + 1); Even with this, an ...
8 years, 11 months ago (2012-01-16 17:04:42 UTC) #8
Ivan Posva
Needs some more work. -Ivan http://codereview.chromium.org/9186035/diff/20002/runtime/bin/eventhandler_linux.cc File runtime/bin/eventhandler_linux.cc (right): http://codereview.chromium.org/9186035/diff/20002/runtime/bin/eventhandler_linux.cc#newcode29 runtime/bin/eventhandler_linux.cc:29: static const int kPortMapGrowingFactor ...
8 years, 11 months ago (2012-01-17 07:57:40 UTC) #9
Søren Gjesse
PTAL http://codereview.chromium.org/9186035/diff/17002/runtime/bin/eventhandler_macos.cc File runtime/bin/eventhandler_macos.cc (right): http://codereview.chromium.org/9186035/diff/17002/runtime/bin/eventhandler_macos.cc#newcode385 runtime/bin/eventhandler_macos.cc:385: return dart::Utils::WordHash(fd + 1); On 2012/01/16 17:04:43, Bill ...
8 years, 11 months ago (2012-01-17 09:28:04 UTC) #10
Ivan Posva
LGTM with comments. -Ivan https://chromiumcodereview.appspot.com/9186035/diff/20002/tests/standalone/src/ProcessStderrTest.dart File tests/standalone/src/ProcessStderrTest.dart (right): https://chromiumcodereview.appspot.com/9186035/diff/20002/tests/standalone/src/ProcessStderrTest.dart#newcode53 tests/standalone/src/ProcessStderrTest.dart:53: process.exitHandler = (exitCode) { On ...
8 years, 11 months ago (2012-01-20 21:42:57 UTC) #11
Søren Gjesse
8 years, 11 months ago (2012-01-23 09:03:49 UTC) #12
https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/eventha...
File runtime/bin/eventhandler_linux.cc (right):

https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/eventha...
runtime/bin/eventhandler_linux.cc:77: sd = new SocketData(fd);
On 2012/01/20 21:42:57, Ivan Posva wrote:
> Please add a comment making it clear that you are now populating the entry in
> the socket_map_.

Done.

https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/hashmap.cc
File runtime/bin/hashmap.cc (right):

https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/hashmap...
runtime/bin/hashmap.cc:37: if (occupancy_ + occupancy_ / 4 >= capacity_) {
On 2012/01/20 21:42:57, Ivan Posva wrote:
> Operator precedence in conjunction with relation operators always makes me
> nervous. Please write LISP:
> if ((occupancy_ + (occupancy_ / 4)) >= capacity_)
> 
> I also am convinced that greatly improves readability for humans.
> 
> Also it might make sense to calculate a limit_ when capacity_ changes and
avoid
> any calculation in this case.

Done.

https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/hashmap.h
File runtime/bin/hashmap.h (right):

https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/hashmap...
runtime/bin/hashmap.h:20: HashMap(MatchFun match = &SamePointerValue, uint32_t
initial_capacity = 8);
On 2012/01/20 21:42:57, Ivan Posva wrote:
> I am not sure I like the default parameters here. Please make the user specify
> them.

OK, removed defaults.

https://chromiumcodereview.appspot.com/9186035/diff/31001/runtime/bin/hashmap...
runtime/bin/hashmap.h:47: intptr_t occupancy() const { return occupancy_; }
On 2012/01/20 21:42:57, Ivan Posva wrote:
> Are occupancy and capacity really needed in the public API of HashMap?

No, removed. It is used a a test, so I added a friend class for that.

Powered by Google App Engine
This is Rietveld 408576698