Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(786)

Issue 8852047: code review 8852047: runtime: do hashmap grow work during reads. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by khr
Modified:
12 years, 1 month ago
Reviewers:
iant, dvyukov
CC:
golang-dev, dvyukov, khr1, iant
Visibility:
Public.

Description

runtime: do hashmap grow work during reads. Before this change, grow work was done only during map writes to ensure multithreaded safety. This can lead to maps remaining in a partially grown state for a long time, potentially forever. This change allows grow work to happen during reads, which will lead to grow work finishing sooner, making the resulting map smaller and faster. Grow work is not done in parallel. Reads can happen in parallel while grow work is happening.

Patch Set 1 #

Patch Set 2 : diff -r 131549887d7c https://code.google.com/p/go/ #

Patch Set 3 : diff -r 5e23075b0970 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 87762a7629b4 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 0fb55e40bd0c https://code.google.com/p/go/ #

Patch Set 6 : diff -r 04036ca6715a https://code.google.com/p/go/ #

Total comments: 2

Patch Set 7 : diff -r 04036ca6715a https://code.google.com/p/go/ #

Total comments: 2

Patch Set 8 : diff -r e2c60757c60d https://code.google.com/p/go/ #

Patch Set 9 : diff -r e2c60757c60d https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -142 lines) Patch
M src/pkg/runtime/hashmap.c View 1 2 3 4 5 6 7 9 chunks +145 lines, -126 lines 0 comments Download
M src/pkg/runtime/hashmap_fast.c View 1 2 3 4 6 chunks +18 lines, -16 lines 0 comments Download

Messages

Total messages: 9
khr
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
12 years, 1 month ago (2013-05-23 22:17:54 UTC) #1
dvyukov
https://codereview.appspot.com/8852047/diff/19003/src/pkg/runtime/hashmap.c File src/pkg/runtime/hashmap.c (right): https://codereview.appspot.com/8852047/diff/19003/src/pkg/runtime/hashmap.c#newcode447 src/pkg/runtime/hashmap.c:447: h->nevacuate = n + 1; please use atomicstorep() to ...
12 years, 1 month ago (2013-05-24 08:22:33 UTC) #2
khr1
On Fri, May 24, 2013 at 1:22 AM, <dvyukov@google.com> wrote: > > https://codereview.appspot.**com/8852047/diff/19003/src/** > pkg/runtime/hashmap.c<https://codereview.appspot.com/8852047/diff/19003/src/pkg/runtime/hashmap.c> ...
12 years, 1 month ago (2013-05-24 13:28:14 UTC) #3
dvyukov
On 2013/05/24 13:28:14, khr1 wrote: > On Fri, May 24, 2013 at 1:22 AM, <mailto:dvyukov@google.com> ...
12 years, 1 month ago (2013-05-31 04:15:47 UTC) #4
khr1
Sorry about that, it's up now. On Thu, May 30, 2013 at 9:15 PM, <dvyukov@google.com> ...
12 years, 1 month ago (2013-05-31 04:27:45 UTC) #5
dvyukov
LGTM I never looked at hashmap code closely before, so I am not skilled to ...
12 years, 1 month ago (2013-05-31 05:31:08 UTC) #6
iant
LGTM https://codereview.appspot.com/8852047/diff/27001/src/pkg/runtime/hashmap.c File src/pkg/runtime/hashmap.c (right): https://codereview.appspot.com/8852047/diff/27001/src/pkg/runtime/hashmap.c#newcode120 src/pkg/runtime/hashmap.c:120: CanFreeBucket = 16, // ok to free buckets ...
12 years, 1 month ago (2013-06-01 00:05:41 UTC) #7
khr1
On Fri, May 31, 2013 at 5:05 PM, <iant@golang.org> wrote: > LGTM > > > ...
12 years, 1 month ago (2013-06-01 03:55:41 UTC) #8
khr
12 years, 1 month ago (2013-06-01 03:58:34 UTC) #9
*** Submitted as https://code.google.com/p/go/source/detail?r=26a3b2e4cdfe ***

runtime: do hashmap grow work during reads.

Before this change, grow work was done only
during map writes to ensure multithreaded safety.
This can lead to maps remaining in a partially
grown state for a long time, potentially forever.
This change allows grow work to happen during reads,
which will lead to grow work finishing sooner, making
the resulting map smaller and faster.

Grow work is not done in parallel.  Reads can
happen in parallel while grow work is happening.

R=golang-dev, dvyukov, khr, iant
CC=golang-dev
https://codereview.appspot.com/8852047
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b