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

Issue 141270043: code review 141270043: runtime: on bigger maps, start iterator at a random bucket. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 7 months ago by khr
Modified:
10 years, 7 months ago
Reviewers:
rsc, iant
CC:
golang-codereviews, iant, khr1
Visibility:
Public.

Description

runtime: on bigger maps, start iterator at a random bucket. This change brings the iter/delete pattern down to O(n lgn) from O(n^2). Fixes issue 8412. before: BenchmarkMapPop100 50000 32498 ns/op BenchmarkMapPop1000 500 3244851 ns/op BenchmarkMapPop10000 5 270276855 ns/op after: BenchmarkMapPop100 100000 16169 ns/op BenchmarkMapPop1000 5000 300416 ns/op BenchmarkMapPop10000 300 5990814 ns/op

Patch Set 1 #

Patch Set 2 : diff -r fc588981a45afa430a2d2cd29d234403cb86e1bd https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 3 : diff -r fc588981a45afa430a2d2cd29d234403cb86e1bd https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 4 : diff -r fc588981a45afa430a2d2cd29d234403cb86e1bd https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 5 : diff -r fc588981a45afa430a2d2cd29d234403cb86e1bd https://khr%40golang.org@code.google.com/p/go/ #

Total comments: 1

Patch Set 6 : diff -r b665a09cf72dd5593a1b38f647cd76ef22398e7b https://khr%40golang.org@code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+44 lines, -10 lines) Patch
M src/runtime/hashmap.go View 1 4 chunks +23 lines, -10 lines 0 comments Download
M src/runtime/map_test.go View 1 2 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 6
khr
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://khr%40golang.org@code.google.com/p/go/
10 years, 7 months ago (2014-09-08 20:33:07 UTC) #1
iant
https://codereview.appspot.com/141270043/diff/80001/src/runtime/hashmap.go File src/runtime/hashmap.go (right): https://codereview.appspot.com/141270043/diff/80001/src/runtime/hashmap.go#newcode128 src/runtime/hashmap.go:128: // If you modify hiter, also change cmd/gc/reflect.c to ...
10 years, 7 months ago (2014-09-08 23:00:29 UTC) #2
khr1
On Mon, Sep 8, 2014 at 4:00 PM, <iant@golang.org> wrote: > > https://codereview.appspot.com/141270043/diff/80001/src/runtime/hashmap.go > File ...
10 years, 7 months ago (2014-09-08 23:07:37 UTC) #3
iant
LGTM
10 years, 7 months ago (2014-09-09 00:00:04 UTC) #4
khr
*** Submitted as https://code.google.com/p/go/source/detail?r=8d62dbfa262c *** runtime: on bigger maps, start iterator at a random bucket. ...
10 years, 7 months ago (2014-09-09 00:42:24 UTC) #5
rsc
10 years, 7 months ago (2014-09-09 00:49:52 UTC) #6
Message was sent while issue was closed.
Please add a proper test, perhaps along the lines of test/maplinear.go. 
The benchmark is good but it won't keep us from breaking this again
the next time we rewrite maps.
Sign in to reply to this message.

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