mirror of
https://github.com/golang/go
synced 2024-11-06 08:26:12 -07:00
2e8dbae85c
This CL implements a LoadAndDelete method in sync.Map. Benchmark: name time/op LoadAndDeleteBalanced/*sync_test.RWMutexMap-12 98.8ns ± 1% LoadAndDeleteBalanced/*sync.Map-12 10.3ns ±11% LoadAndDeleteUnique/*sync_test.RWMutexMap-12 99.2ns ± 2% LoadAndDeleteUnique/*sync.Map-12 6.63ns ±10% LoadAndDeleteCollision/*sync_test.DeepCopyMap-12 140ns ± 0% LoadAndDeleteCollision/*sync_test.RWMutexMap-12 75.2ns ± 2% LoadAndDeleteCollision/*sync.Map-12 5.21ns ± 5% In addition, Delete is bounded and more efficient if many collisions: DeleteCollision/*sync_test.DeepCopyMap-12 120ns ± 2% 125ns ± 1% +3.80% (p=0.000 n=10+9) DeleteCollision/*sync_test.RWMutexMap-12 73.5ns ± 3% 79.5ns ± 1% +8.03% (p=0.000 n=10+9) DeleteCollision/*sync.Map-12 97.8ns ± 3% 5.9ns ± 4% -94.00% (p=0.000 n=10+10) Fixes #33762 Change-Id: Ic8469a7861d27ab0edeface0078aad8af9b26c2f Reviewed-on: https://go-review.googlesource.com/c/go/+/205899 Reviewed-by: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> |
||
---|---|---|
.. | ||
articles | ||
codewalk | ||
gopher | ||
play | ||
progs | ||
asm.html | ||
cmd.html | ||
contrib.html | ||
contribute.html | ||
debugging_with_gdb.html | ||
diagnostics.html | ||
editors.html | ||
effective_go.html | ||
gccgo_contribute.html | ||
gccgo_install.html | ||
go1.1.html | ||
go1.2.html | ||
go1.3.html | ||
go1.4.html | ||
go1.5.html | ||
go1.6.html | ||
go1.7.html | ||
go1.8.html | ||
go1.9.html | ||
go1.10.html | ||
go1.11.html | ||
go1.12.html | ||
go1.13.html | ||
go1.14.html | ||
go1.15.html | ||
go1.html | ||
go1compat.html | ||
go_faq.html | ||
go_mem.html | ||
go_spec.html | ||
go-logo-black.png | ||
go-logo-blue.png | ||
go-logo-white.png | ||
help.html | ||
ie.css | ||
install-source.html | ||
install.html | ||
share.png | ||
tos.html |