diff options
| author | Keith Randall <khr@golang.org> | 2014-09-08 17:42:21 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2014-09-08 17:42:21 -0700 |
| commit | 55c458e05f35d0d5d539107da07b744ad96f268e (patch) | |
| tree | d42d331a837fed9fe38c2d2b1fbbcfde48c540ae /src/runtime/stack.c | |
| parent | d2788dc50308104ae642bd3fc043f2faf9bb413f (diff) | |
| download | go-55c458e05f35d0d5d539107da07b744ad96f268e.tar.xz | |
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 #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
LGTM=iant
R=golang-codereviews, iant, khr
CC=golang-codereviews
https://golang.org/cl/141270043
Diffstat (limited to 'src/runtime/stack.c')
0 files changed, 0 insertions, 0 deletions
