- 27 Feb, 2019 1 commit
-
-
Michael Matloob authored
This change adds a go.mod file to this repo, following the requirements stated in bcmills's comment here: https://golang.org/issue/28136#issuecomment-462971974. It's important to note that we will not be adding versions to the repo for now. This change does not add a go.sum because this repo has no dependencies. The change was generated by running "go mod init" and "go mod tidy" using Go 1.11.5 in the top-level directory of the repository. Updates golang/go#28136 Change-Id: Ie4f1270a0dfefd4239badf86daa0d7a5b17fd0d5 Reviewed-on: https://go-review.googlesource.com/c/162823 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
-
- 21 Dec, 2018 1 commit
-
-
Jean de Klerk authored
Change-Id: Ie64db438145a307ec8aef8fd412d445a2fe74d40 Reviewed-on: https://go-review.googlesource.com/c/136995Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
- 08 Nov, 2018 1 commit
-
-
Jean de Klerk authored
Change-Id: Idbfe40e7cb9f99ca3dc7d4c214de6b9e028eefb7 Reviewed-on: https://go-review.googlesource.com/c/148277Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 14 Mar, 2018 1 commit
-
-
Andrew Bonventre authored
Updates golang/go#24185 Change-Id: I892f30f02f9ae40554790e9c177cb79d193bffd5 Reviewed-on: https://go-review.googlesource.com/100696Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
- 01 Nov, 2017 1 commit
-
-
Bryan C. Mills authored
I've commented several times in various forums that basically every time I've seen the “worker goroutine” pattern in Go, there has turned out to be a cleaner implementation using semaphores. This change adds a simple such example. (For more complex usage, I would generally pair the semaphore with an errgroup.Group.) Change-Id: Ibf69ee761d14ba59c1acc6a2d595b4fcf0d8f6d6 Reviewed-on: https://go-review.googlesource.com/75170Reviewed-by: Ross Light <light@google.com>
-
- 27 Sep, 2017 1 commit
-
-
Kevin Burke authored
Move the README to README.md so Gerrit can render it; currently Gerrit only renders files named exactly "README.md" (for example at https://go.googlesource.com/go). Add more links to the README explaining how to file issues, how to submit code changes, where to download the code to and how to get it. Hopefully this should help people who go to https://go.googlesource.com/sync or https://github.com/golang/sync figure out how to get started with development. Change-Id: Iafdbec407bd6f61459aabe6e2c4703132d038b69 Reviewed-on: https://go-review.googlesource.com/49872Reviewed-by: Kevin Burke <kev@inburke.com>
-
- 17 May, 2017 1 commit
-
-
Jonathan Amsterdam authored
TestWeighted's runtime was roughly proportional to the number of CPUs, so it ran a long time on PPCs (160 CPUs). Make the number of loops in the test an inverse function of the number of CPUs, to keep the test short. Change-Id: Id853dbb5e5e2f9fb95966d19ef0c511e3f8080e0 Reviewed-on: https://go-review.googlesource.com/43632Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 10 May, 2017 1 commit
-
-
Bryan C. Mills authored
The mainline syncmap.Map has allowed mutations within Range callbacks since https://golang.org/cl/37342. The reference implementations used in map_bench_test need to do the same. Change-Id: Id73d254fa01cc64a1f00eb1903488796e1282423 Reviewed-on: https://go-review.googlesource.com/42956 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
- 04 May, 2017 1 commit
-
-
Bryan C. Mills authored
See https://go-review.googlesource.com/c/42095/. Change-Id: I9f15a785bb4bd28ab02f17de65c63ad4b6e083c9 Reviewed-on: https://go-review.googlesource.com/42594Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 18 Apr, 2017 1 commit
-
-
Jonathan Amsterdam authored
Change-Id: I21c5dc48ffe43aa27c50a42f9c9a01ac1f0c747c Reviewed-on: https://go-review.googlesource.com/40991Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Glenn Lewis <gmlewis@google.com>
-
- 17 Mar, 2017 1 commit
-
-
Jonathan Amsterdam authored
This package provides a weighted semaphore that is context-aware. The code is derived from a similar package inside Google. Change-Id: Id1dad96d79e8ccfd289e4299e8265aa5bdad3a5b Reviewed-on: https://go-review.googlesource.com/38298Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 15 Mar, 2017 1 commit
-
-
Bryan C. Mills authored
In the previous version, Loads of keys with unchanged values would block on the Mutex if the map was dirty, leading to potentially long stalls while the read-only map is being copied to the dirty map. This change adds a double pointer indirection to each entry and an extra atomic load on the fast path. In exchange, it removes the need to lock the map for nearly all operations on existing keys. Each entry is represented by an atomically-updated pointer to an interface{} value. The same entries are stored in both the read-only and dirty maps. Keys deleted before the dirty map was last copied are marked as "expunged" and omitted from the dirty map until the next Store to that key. Newly-stored values exist only in the dirty map. The existence of new keys in the dirty map is indicated by an "amended" bit attached to the read-only map, allowing Load or Delete calls for nonexistent keys to sometimes return immediately (without acquiring the Mutex). This trades off a bit of steady-state throughput in the "mostly hits" case in exchange for less contention (and lower Load tail latencies) for mixed Load/Store/Delete usage. Unfortunately, the latency impact is currently difficult to measure (#19128). updates golang/go#19128 updates golang/go#18177 https://perf.golang.org/search?q=upload:20170315.5 name old time/op new time/op delta LoadMostlyHits/*syncmap_test.DeepCopyMap 70.3ns ± 6% 70.2ns ± 4% ~ (p=0.886 n=4+4) LoadMostlyHits/*syncmap_test.DeepCopyMap-48 10.9ns ± 4% 13.6ns ±24% ~ (p=0.314 n=4+4) LoadMostlyHits/*syncmap_test.RWMutexMap 86.0ns ± 9% 86.0ns ± 4% ~ (p=1.000 n=4+4) LoadMostlyHits/*syncmap_test.RWMutexMap-48 140ns ± 3% 139ns ± 2% ~ (p=0.686 n=4+4) LoadMostlyHits/*syncmap.Map 70.6ns ± 8% 70.3ns ± 1% ~ (p=0.571 n=4+4) LoadMostlyHits/*syncmap.Map-48 10.3ns ± 7% 11.2ns ± 5% ~ (p=0.114 n=4+4) LoadMostlyMisses/*syncmap_test.DeepCopyMap 59.4ns ± 4% 59.4ns ± 4% ~ (p=1.000 n=4+4) LoadMostlyMisses/*syncmap_test.DeepCopyMap-48 10.4ns ±30% 12.6ns ±29% ~ (p=0.486 n=4+4) LoadMostlyMisses/*syncmap_test.RWMutexMap 64.8ns ± 6% 63.8ns ± 4% ~ (p=0.686 n=4+4) LoadMostlyMisses/*syncmap_test.RWMutexMap-48 138ns ± 3% 139ns ± 2% ~ (p=0.800 n=4+4) LoadMostlyMisses/*syncmap.Map 51.5ns ± 7% 50.4ns ± 2% ~ (p=0.371 n=4+4) LoadMostlyMisses/*syncmap.Map-48 9.37ns ± 3% 9.40ns ± 3% ~ (p=0.886 n=4+4) LoadOrStoreBalanced/*syncmap_test.RWMutexMap 820ns ±17% 834ns ±14% ~ (p=1.000 n=4+4) LoadOrStoreBalanced/*syncmap_test.RWMutexMap-48 1.38µs ± 4% 1.38µs ± 3% ~ (p=0.886 n=4+4) LoadOrStoreBalanced/*syncmap.Map 709ns ±13% 1085ns ± 9% +53.09% (p=0.029 n=4+4) LoadOrStoreBalanced/*syncmap.Map-48 1.30µs ±13% 1.08µs ± 8% -17.40% (p=0.029 n=4+4) LoadOrStoreUnique/*syncmap_test.RWMutexMap 1.26µs ±14% 1.16µs ±29% ~ (p=0.343 n=4+4) LoadOrStoreUnique/*syncmap_test.RWMutexMap-48 1.82µs ±15% 1.98µs ± 6% ~ (p=0.143 n=4+4) LoadOrStoreUnique/*syncmap.Map 1.06µs ± 7% 1.86µs ±11% +76.09% (p=0.029 n=4+4) LoadOrStoreUnique/*syncmap.Map-48 2.00µs ± 4% 1.62µs ± 4% -19.20% (p=0.029 n=4+4) LoadOrStoreCollision/*syncmap_test.DeepCopyMap 32.9ns ± 8% 32.6ns ± 9% ~ (p=0.686 n=4+4) LoadOrStoreCollision/*syncmap_test.DeepCopyMap-48 2.26ns ±136% 3.41ns ±62% ~ (p=0.114 n=4+4) LoadOrStoreCollision/*syncmap_test.RWMutexMap 58.0ns ±20% 54.6ns ±17% ~ (p=0.343 n=4+4) LoadOrStoreCollision/*syncmap_test.RWMutexMap-48 458ns ± 2% 445ns ± 6% ~ (p=0.229 n=4+4) LoadOrStoreCollision/*syncmap.Map 35.8ns ± 5% 39.6ns ± 9% ~ (p=0.114 n=4+4) LoadOrStoreCollision/*syncmap.Map-48 1.24ns ± 2% 1.58ns ± 4% +27.16% (p=0.029 n=4+4) Range/*syncmap_test.DeepCopyMap 19.7µs ± 4% 19.8µs ± 3% ~ (p=0.686 n=4+4) Range/*syncmap_test.DeepCopyMap-48 763ns ± 1% 864ns ± 3% +13.24% (p=0.029 n=4+4) Range/*syncmap_test.RWMutexMap 20.9µs ± 3% 20.4µs ± 4% ~ (p=0.343 n=4+4) Range/*syncmap_test.RWMutexMap-48 764ns ± 1% 870ns ± 1% +13.77% (p=0.029 n=4+4) Range/*syncmap.Map 20.4µs ± 5% 22.7µs ± 5% +10.98% (p=0.029 n=4+4) Range/*syncmap.Map-48 776ns ± 3% 954ns ± 4% +22.95% (p=0.029 n=4+4) AdversarialAlloc/*syncmap_test.DeepCopyMap 206ns ± 5% 199ns ± 2% ~ (p=0.200 n=4+4) AdversarialAlloc/*syncmap_test.DeepCopyMap-48 8.94µs ± 5% 9.21µs ± 4% ~ (p=0.200 n=4+4) AdversarialAlloc/*syncmap_test.RWMutexMap 63.4ns ± 4% 63.8ns ± 3% ~ (p=0.686 n=4+4) AdversarialAlloc/*syncmap_test.RWMutexMap-48 184ns ±10% 198ns ±11% ~ (p=0.343 n=4+4) AdversarialAlloc/*syncmap.Map 213ns ± 3% 264ns ± 3% +23.97% (p=0.029 n=4+4) AdversarialAlloc/*syncmap.Map-48 556ns ± 5% 1389ns ± 8% +149.93% (p=0.029 n=4+4) AdversarialDelete/*syncmap_test.DeepCopyMap 300ns ± 6% 304ns ± 7% ~ (p=0.886 n=4+4) AdversarialDelete/*syncmap_test.DeepCopyMap-48 647ns ± 3% 646ns ± 3% ~ (p=0.943 n=4+4) AdversarialDelete/*syncmap_test.RWMutexMap 69.1ns ± 1% 69.2ns ± 6% ~ (p=0.686 n=4+4) AdversarialDelete/*syncmap_test.RWMutexMap-48 289ns ±15% 300ns ±17% ~ (p=0.829 n=4+4) AdversarialDelete/*syncmap.Map 198ns ± 5% 264ns ± 2% +33.17% (p=0.029 n=4+4) AdversarialDelete/*syncmap.Map-48 291ns ± 9% 173ns ± 8% -40.50% (p=0.029 n=4+4) name old alloc/op new alloc/op delta LoadMostlyHits/*syncmap_test.DeepCopyMap 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyHits/*syncmap_test.DeepCopyMap-48 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyHits/*syncmap_test.RWMutexMap 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyHits/*syncmap_test.RWMutexMap-48 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyHits/*syncmap.Map 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyHits/*syncmap.Map-48 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyMisses/*syncmap_test.DeepCopyMap 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyMisses/*syncmap_test.DeepCopyMap-48 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyMisses/*syncmap_test.RWMutexMap 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyMisses/*syncmap_test.RWMutexMap-48 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyMisses/*syncmap.Map 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadMostlyMisses/*syncmap.Map-48 7.00B ± 0% 7.00B ± 0% ~ (all equal) LoadOrStoreBalanced/*syncmap_test.RWMutexMap 95.0B ± 0% 95.0B ± 0% ~ (all equal) LoadOrStoreBalanced/*syncmap_test.RWMutexMap-48 95.0B ± 0% 95.0B ± 0% ~ (all equal) LoadOrStoreBalanced/*syncmap.Map 95.0B ± 0% 88.0B ± 0% -7.37% (p=0.029 n=4+4) LoadOrStoreBalanced/*syncmap.Map-48 95.0B ± 0% 88.0B ± 0% -7.37% (p=0.029 n=4+4) LoadOrStoreUnique/*syncmap_test.RWMutexMap 175B ± 0% 175B ± 0% ~ (all equal) LoadOrStoreUnique/*syncmap_test.RWMutexMap-48 175B ± 0% 175B ± 0% ~ (all equal) LoadOrStoreUnique/*syncmap.Map 175B ± 0% 161B ± 0% -8.00% (p=0.029 n=4+4) LoadOrStoreUnique/*syncmap.Map-48 175B ± 0% 161B ± 0% -8.00% (p=0.029 n=4+4) LoadOrStoreCollision/*syncmap_test.DeepCopyMap 0.00B 0.00B ~ (all equal) LoadOrStoreCollision/*syncmap_test.DeepCopyMap-48 0.00B 0.00B ~ (all equal) LoadOrStoreCollision/*syncmap_test.RWMutexMap 0.00B 0.00B ~ (all equal) LoadOrStoreCollision/*syncmap_test.RWMutexMap-48 0.00B 0.00B ~ (all equal) LoadOrStoreCollision/*syncmap.Map 0.00B 0.00B ~ (all equal) LoadOrStoreCollision/*syncmap.Map-48 0.00B 0.00B ~ (all equal) Range/*syncmap_test.DeepCopyMap 0.00B 0.00B ~ (all equal) Range/*syncmap_test.DeepCopyMap-48 0.00B 0.00B ~ (all equal) Range/*syncmap_test.RWMutexMap 0.00B 0.00B ~ (all equal) Range/*syncmap_test.RWMutexMap-48 0.00B 0.00B ~ (all equal) Range/*syncmap.Map 0.00B 0.00B ~ (all equal) Range/*syncmap.Map-48 0.00B 0.00B ~ (all equal) AdversarialAlloc/*syncmap_test.DeepCopyMap 74.0B ± 0% 74.0B ± 0% ~ (all equal) AdversarialAlloc/*syncmap_test.DeepCopyMap-48 3.15kB ± 0% 3.15kB ± 0% ~ (p=1.000 n=4+4) AdversarialAlloc/*syncmap_test.RWMutexMap 8.00B ± 0% 8.00B ± 0% ~ (all equal) AdversarialAlloc/*syncmap_test.RWMutexMap-48 8.00B ± 0% 8.00B ± 0% ~ (all equal) AdversarialAlloc/*syncmap.Map 74.0B ± 0% 55.0B ± 0% -25.68% (p=0.029 n=4+4) AdversarialAlloc/*syncmap.Map-48 8.00B ± 0% 56.25B ± 1% +603.12% (p=0.029 n=4+4) AdversarialDelete/*syncmap_test.DeepCopyMap 155B ± 0% 155B ± 0% ~ (all equal) AdversarialDelete/*syncmap_test.DeepCopyMap-48 156B ± 0% 156B ± 0% ~ (p=1.000 n=4+4) AdversarialDelete/*syncmap_test.RWMutexMap 8.00B ± 0% 8.00B ± 0% ~ (all equal) AdversarialDelete/*syncmap_test.RWMutexMap-48 8.00B ± 0% 8.00B ± 0% ~ (all equal) AdversarialDelete/*syncmap.Map 81.0B ± 0% 65.0B ± 0% -19.75% (p=0.029 n=4+4) AdversarialDelete/*syncmap.Map-48 23.0B ± 9% 15.2B ± 5% -33.70% (p=0.029 n=4+4) name old allocs/op new allocs/op delta LoadMostlyHits/*syncmap_test.DeepCopyMap 0.00 0.00 ~ (all equal) LoadMostlyHits/*syncmap_test.DeepCopyMap-48 0.00 0.00 ~ (all equal) LoadMostlyHits/*syncmap_test.RWMutexMap 0.00 0.00 ~ (all equal) LoadMostlyHits/*syncmap_test.RWMutexMap-48 0.00 0.00 ~ (all equal) LoadMostlyHits/*syncmap.Map 0.00 0.00 ~ (all equal) LoadMostlyHits/*syncmap.Map-48 0.00 0.00 ~ (all equal) LoadMostlyMisses/*syncmap_test.DeepCopyMap 0.00 0.00 ~ (all equal) LoadMostlyMisses/*syncmap_test.DeepCopyMap-48 0.00 0.00 ~ (all equal) LoadMostlyMisses/*syncmap_test.RWMutexMap 0.00 0.00 ~ (all equal) LoadMostlyMisses/*syncmap_test.RWMutexMap-48 0.00 0.00 ~ (all equal) LoadMostlyMisses/*syncmap.Map 0.00 0.00 ~ (all equal) LoadMostlyMisses/*syncmap.Map-48 0.00 0.00 ~ (all equal) LoadOrStoreBalanced/*syncmap_test.RWMutexMap 2.00 ± 0% 2.00 ± 0% ~ (all equal) LoadOrStoreBalanced/*syncmap_test.RWMutexMap-48 2.00 ± 0% 2.00 ± 0% ~ (all equal) LoadOrStoreBalanced/*syncmap.Map 2.00 ± 0% 3.00 ± 0% +50.00% (p=0.029 n=4+4) LoadOrStoreBalanced/*syncmap.Map-48 2.00 ± 0% 3.00 ± 0% +50.00% (p=0.029 n=4+4) LoadOrStoreUnique/*syncmap_test.RWMutexMap 2.00 ± 0% 2.00 ± 0% ~ (all equal) LoadOrStoreUnique/*syncmap_test.RWMutexMap-48 2.00 ± 0% 2.00 ± 0% ~ (all equal) LoadOrStoreUnique/*syncmap.Map 2.00 ± 0% 4.00 ± 0% +100.00% (p=0.029 n=4+4) LoadOrStoreUnique/*syncmap.Map-48 2.00 ± 0% 4.00 ± 0% +100.00% (p=0.029 n=4+4) LoadOrStoreCollision/*syncmap_test.DeepCopyMap 0.00 0.00 ~ (all equal) LoadOrStoreCollision/*syncmap_test.DeepCopyMap-48 0.00 0.00 ~ (all equal) LoadOrStoreCollision/*syncmap_test.RWMutexMap 0.00 0.00 ~ (all equal) LoadOrStoreCollision/*syncmap_test.RWMutexMap-48 0.00 0.00 ~ (all equal) LoadOrStoreCollision/*syncmap.Map 0.00 0.00 ~ (all equal) LoadOrStoreCollision/*syncmap.Map-48 0.00 0.00 ~ (all equal) Range/*syncmap_test.DeepCopyMap 0.00 0.00 ~ (all equal) Range/*syncmap_test.DeepCopyMap-48 0.00 0.00 ~ (all equal) Range/*syncmap_test.RWMutexMap 0.00 0.00 ~ (all equal) Range/*syncmap_test.RWMutexMap-48 0.00 0.00 ~ (all equal) Range/*syncmap.Map 0.00 0.00 ~ (all equal) Range/*syncmap.Map-48 0.00 0.00 ~ (all equal) AdversarialAlloc/*syncmap_test.DeepCopyMap 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialAlloc/*syncmap_test.DeepCopyMap-48 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialAlloc/*syncmap_test.RWMutexMap 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialAlloc/*syncmap_test.RWMutexMap-48 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialAlloc/*syncmap.Map 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialAlloc/*syncmap.Map-48 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialDelete/*syncmap_test.DeepCopyMap 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialDelete/*syncmap_test.DeepCopyMap-48 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialDelete/*syncmap_test.RWMutexMap 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialDelete/*syncmap_test.RWMutexMap-48 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialDelete/*syncmap.Map 1.00 ± 0% 1.00 ± 0% ~ (all equal) AdversarialDelete/*syncmap.Map-48 1.00 ± 0% 1.00 ± 0% ~ (all equal) Change-Id: I93c9458505d84238cc8e9016a7dfd285868af236 Reviewed-on: https://go-review.googlesource.com/37342Reviewed-by: Russ Cox <rsc@golang.org>
-
- 16 Feb, 2017 2 commits
-
-
Bryan C. Mills authored
Add a test for Range with concurrent Loads and Stores. The previous quick-check tests generated long, mostly-non-ASCII strings that were hard to debug on failure; this change makes the keys and values short and human-readable, which also tends to produce more key collisions in the test as a side-effect. updates golang/go#18177 Change-Id: Ie56a64ec9fe295435682b90c3e6466ed5b349bf9 Reviewed-on: https://go-review.googlesource.com/37150Reviewed-by: Russ Cox <rsc@golang.org>
-
Bryan C. Mills authored
adjust BenchmarkAdversarialDelete to be somewhat more adversarial. updates golang/go#18177 Change-Id: Id01ed1077a0447dcfc6ea3929c22baaddbc9d6ee Reviewed-on: https://go-review.googlesource.com/37151Reviewed-by: Russ Cox <rsc@golang.org>
-
- 15 Feb, 2017 1 commit
-
-
Bryan C. Mills authored
This is a draft for the sync.Map API proposed in golang/go#18177. It supports fast-path loads via an atomic variable, falling back to a Mutex for stores. In order to keep stores amortized to O(1), loads following a store follow the Mutex path until enough loads have occurred to offset the cost of a deep copy. For mostly-read loads, such as the maps in the reflect package in the standard library, this significantly reduces cache-line contention vs. a plain RWMutex with a map. goos: linux goarch: amd64 pkg: golang.org/x/sync/syncmap BenchmarkLoadMostlyHits/*syncmap_test.DeepCopyMap 20000000 73.1 ns/op BenchmarkLoadMostlyHits/*syncmap_test.DeepCopyMap-48 100000000 13.8 ns/op BenchmarkLoadMostlyHits/*syncmap_test.RWMutexMap 20000000 87.7 ns/op BenchmarkLoadMostlyHits/*syncmap_test.RWMutexMap-48 10000000 154 ns/op BenchmarkLoadMostlyHits/*syncmap.Map 20000000 72.1 ns/op BenchmarkLoadMostlyHits/*syncmap.Map-48 100000000 11.2 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.DeepCopyMap 20000000 63.2 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.DeepCopyMap-48 200000000 14.2 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.RWMutexMap 20000000 72.7 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.RWMutexMap-48 10000000 150 ns/op BenchmarkLoadMostlyMisses/*syncmap.Map 30000000 56.4 ns/op BenchmarkLoadMostlyMisses/*syncmap.Map-48 200000000 9.77 ns/op BenchmarkLoadOrStoreBalanced/*syncmap_test.RWMutexMap 2000000 683 ns/op BenchmarkLoadOrStoreBalanced/*syncmap_test.RWMutexMap-48 1000000 1394 ns/op BenchmarkLoadOrStoreBalanced/*syncmap.Map 2000000 645 ns/op BenchmarkLoadOrStoreBalanced/*syncmap.Map-48 1000000 1253 ns/op BenchmarkLoadOrStoreUnique/*syncmap_test.RWMutexMap 1000000 1015 ns/op BenchmarkLoadOrStoreUnique/*syncmap_test.RWMutexMap-48 1000000 1911 ns/op BenchmarkLoadOrStoreUnique/*syncmap.Map 1000000 1018 ns/op BenchmarkLoadOrStoreUnique/*syncmap.Map-48 1000000 1776 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.DeepCopyMap 50000000 30.2 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.DeepCopyMap-48 2000000000 1.24 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.RWMutexMap 30000000 50.1 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.RWMutexMap-48 5000000 451 ns/op BenchmarkLoadOrStoreCollision/*syncmap.Map 30000000 36.8 ns/op BenchmarkLoadOrStoreCollision/*syncmap.Map-48 2000000000 1.24 ns/op BenchmarkAdversarialAlloc/*syncmap_test.DeepCopyMap 10000000 213 ns/op BenchmarkAdversarialAlloc/*syncmap_test.DeepCopyMap-48 1000000 5012 ns/op BenchmarkAdversarialAlloc/*syncmap_test.RWMutexMap 20000000 68.8 ns/op BenchmarkAdversarialAlloc/*syncmap_test.RWMutexMap-48 5000000 429 ns/op BenchmarkAdversarialAlloc/*syncmap.Map 5000000 229 ns/op BenchmarkAdversarialAlloc/*syncmap.Map-48 2000000 600 ns/op BenchmarkAdversarialDelete/*syncmap_test.DeepCopyMap 5000000 314 ns/op BenchmarkAdversarialDelete/*syncmap_test.DeepCopyMap-48 2000000 726 ns/op BenchmarkAdversarialDelete/*syncmap_test.RWMutexMap 20000000 63.2 ns/op BenchmarkAdversarialDelete/*syncmap_test.RWMutexMap-48 5000000 469 ns/op BenchmarkAdversarialDelete/*syncmap.Map 10000000 203 ns/op BenchmarkAdversarialDelete/*syncmap.Map-48 10000000 253 ns/op goos: linux goarch: ppc64le pkg: golang.org/x/sync/syncmap BenchmarkLoadMostlyHits/*syncmap_test.DeepCopyMap 5000000 253 ns/op BenchmarkLoadMostlyHits/*syncmap_test.DeepCopyMap-48 50000000 26.2 ns/op BenchmarkLoadMostlyHits/*syncmap_test.RWMutexMap 5000000 505 ns/op BenchmarkLoadMostlyHits/*syncmap_test.RWMutexMap-48 3000000 443 ns/op BenchmarkLoadMostlyHits/*syncmap.Map 10000000 200 ns/op BenchmarkLoadMostlyHits/*syncmap.Map-48 100000000 18.1 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.DeepCopyMap 10000000 162 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.DeepCopyMap-48 100000000 23.8 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.RWMutexMap 10000000 195 ns/op BenchmarkLoadMostlyMisses/*syncmap_test.RWMutexMap-48 3000000 531 ns/op BenchmarkLoadMostlyMisses/*syncmap.Map 10000000 182 ns/op BenchmarkLoadMostlyMisses/*syncmap.Map-48 100000000 15.8 ns/op BenchmarkLoadOrStoreBalanced/*syncmap_test.RWMutexMap 1000000 1664 ns/op BenchmarkLoadOrStoreBalanced/*syncmap_test.RWMutexMap-48 1000000 1768 ns/op BenchmarkLoadOrStoreBalanced/*syncmap.Map 1000000 2128 ns/op BenchmarkLoadOrStoreBalanced/*syncmap.Map-48 1000000 1903 ns/op BenchmarkLoadOrStoreUnique/*syncmap_test.RWMutexMap 1000000 2657 ns/op BenchmarkLoadOrStoreUnique/*syncmap_test.RWMutexMap-48 1000000 2577 ns/op BenchmarkLoadOrStoreUnique/*syncmap.Map 1000000 1714 ns/op BenchmarkLoadOrStoreUnique/*syncmap.Map-48 1000000 2484 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.DeepCopyMap 10000000 130 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.DeepCopyMap-48 100000000 11.3 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.RWMutexMap 3000000 426 ns/op BenchmarkLoadOrStoreCollision/*syncmap_test.RWMutexMap-48 2000000 930 ns/op BenchmarkLoadOrStoreCollision/*syncmap.Map 10000000 131 ns/op BenchmarkLoadOrStoreCollision/*syncmap.Map-48 300000000 4.07 ns/op BenchmarkAdversarialAlloc/*syncmap_test.DeepCopyMap 3000000 447 ns/op BenchmarkAdversarialAlloc/*syncmap_test.DeepCopyMap-48 300000 4159 ns/op BenchmarkAdversarialAlloc/*syncmap_test.RWMutexMap 10000000 191 ns/op BenchmarkAdversarialAlloc/*syncmap_test.RWMutexMap-48 3000000 535 ns/op BenchmarkAdversarialAlloc/*syncmap.Map 2000000 525 ns/op BenchmarkAdversarialAlloc/*syncmap.Map-48 1000000 1000 ns/op BenchmarkAdversarialDelete/*syncmap_test.DeepCopyMap 2000000 711 ns/op BenchmarkAdversarialDelete/*syncmap_test.DeepCopyMap-48 2000000 900 ns/op BenchmarkAdversarialDelete/*syncmap_test.RWMutexMap 3000000 354 ns/op BenchmarkAdversarialDelete/*syncmap_test.RWMutexMap-48 3000000 473 ns/op BenchmarkAdversarialDelete/*syncmap.Map 2000000 1357 ns/op BenchmarkAdversarialDelete/*syncmap.Map-48 5000000 334 ns/op Updates golang/go#18177 Change-Id: I8d561b617b1cd2ca03a8e68a5d5a28a519a0ce38 Reviewed-on: https://go-review.googlesource.com/33912Reviewed-by: Russ Cox <rsc@golang.org>
-
- 06 Dec, 2016 1 commit
-
-
Josh Bleecher Snyder authored
This makes git-codereview review issue references to refer to the main Go repo. Change-Id: I17003885f15358f776a475a76a31dac179de9676 Reviewed-on: https://go-review.googlesource.com/33908Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
- 01 Dec, 2016 1 commit
-
-
Bryan C. Mills authored
Change-Id: I0c2f0ce9b6006dac13c5f5faed752a2475992805 Reviewed-on: https://go-review.googlesource.com/33851Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
- 04 Oct, 2016 1 commit
-
-
Matt Layher authored
Updates golang/go#17338 Change-Id: Icf1972cdec0bbc9b3142141d9e706c07f312efc0 Reviewed-on: https://go-review.googlesource.com/30292Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 15 Jul, 2016 3 commits
-
-
Bryan C. Mills authored
The builders should be happy building errgroup instead now. Change-Id: I99f549032f771e067b5f7780eba1cc6e91bbdfa5 Reviewed-on: https://go-review.googlesource.com/24962 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Bryan C. Mills authored
Change-Id: Ie5ebfa26b6234f833139784da859d32cc1416b26 Reviewed-on: https://go-review.googlesource.com/24961Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Bryan C. Mills authored
Package errgroup provides synchronization, error propagation, and Context cancellation for groups of goroutines working on subtasks of a common task. Change-Id: Ic9e51f6f846124076bbff9d53b0f09dc7fc5f2f0 Reviewed-on: https://go-review.googlesource.com/24894Reviewed-by: Sameer Ajmani <sameer@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
- 13 Jul, 2016 1 commit
-
-
Brad Fitzpatrick authored
Change-Id: I6e4fbebee02076b8c9d43318c3f7260f2339c1a3 Reviewed-on: https://go-review.googlesource.com/24907Reviewed-by: Quentin Smith <quentin@golang.org>
-
- 30 Oct, 2015 1 commit
-
-
Andrew Gerrand authored
-