Benchmarks done with go 1.12 version.
mbp 2017 results
- CPU: Intel Core i7-7820HQ @ 2.90GHz
- RAM: 16 GB 2133 MHz LPDDR3
goos: darwin
goarch: amd64
pkg: sync
BenchmarkCond1-8 10000000 236 ns/op 0 B/op 0 allocs/op
BenchmarkCond2-8 1000000 1484 ns/op 0 B/op 0 allocs/op
BenchmarkCond4-8 500000 2616 ns/op 0 B/op 0 allocs/op
BenchmarkCond8-8 300000 4242 ns/op 0 B/op 0 allocs/op
BenchmarkCond16-8 200000 6137 ns/op 0 B/op 0 allocs/op
BenchmarkCond32-8 100000 13184 ns/op 0 B/op 0 allocs/op
BenchmarkLoadMostlyHits/*sync_test.DeepCopyMap-8 100000000 13.8 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyHits/*sync_test.RWMutexMap-8 30000000 51.7 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyHits/*sync.Map-8 100000000 15.8 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyMisses/*sync_test.DeepCopyMap-8 100000000 11.9 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyMisses/*sync_test.RWMutexMap-8 30000000 50.9 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyMisses/*sync.Map-8 100000000 10.6 ns/op 7 B/op 0 allocs/op
BenchmarkLoadOrStoreBalanced/*sync_test.RWMutexMap-8 5000000 377 ns/op 80 B/op 2 allocs/op
BenchmarkLoadOrStoreBalanced/*sync.Map-8 5000000 495 ns/op 77 B/op 3 allocs/op
BenchmarkLoadOrStoreUnique/*sync_test.RWMutexMap-8 3000000 529 ns/op 127 B/op 2 allocs/op
BenchmarkLoadOrStoreUnique/*sync.Map-8 2000000 748 ns/op 163 B/op 4 allocs/op
BenchmarkLoadOrStoreCollision/*sync_test.DeepCopyMap-8 200000000 7.17 ns/op 0 B/op 0 allocs/op
BenchmarkLoadOrStoreCollision/*sync_test.RWMutexMap-8 20000000 103 ns/op 0 B/op 0 allocs/op
BenchmarkLoadOrStoreCollision/*sync.Map-8 200000000 7.98 ns/op 0 B/op 0 allocs/op
BenchmarkRange/*sync_test.DeepCopyMap-8 500000 3797 ns/op 0 B/op 0 allocs/op
BenchmarkRange/*sync_test.RWMutexMap-8 30000 54853 ns/op 16384 B/op 1 allocs/op
BenchmarkRange/*sync.Map-8 300000 4148 ns/op 0 B/op 0 allocs/op
BenchmarkAdversarialAlloc/*sync_test.DeepCopyMap-8 2000000 719 ns/op 534 B/op 1 allocs/op
BenchmarkAdversarialAlloc/*sync_test.RWMutexMap-8 20000000 67.6 ns/op 8 B/op 1 allocs/op
BenchmarkAdversarialAlloc/*sync.Map-8 5000000 254 ns/op 51 B/op 1 allocs/op
BenchmarkAdversarialDelete/*sync_test.DeepCopyMap-8 10000000 190 ns/op 168 B/op 1 allocs/op
BenchmarkAdversarialDelete/*sync_test.RWMutexMap-8 20000000 76.4 ns/op 25 B/op 1 allocs/op
BenchmarkAdversarialDelete/*sync.Map-8 20000000 61.2 ns/op 18 B/op 1 allocs/op
BenchmarkUncontendedSemaphore-8 100000000 19.3 ns/op 0 B/op 0 allocs/op
BenchmarkContendedSemaphore-8 50000000 27.5 ns/op 0 B/op 0 allocs/op
BenchmarkMutexUncontended-8 500000000 3.42 ns/op 0 B/op 0 allocs/op
BenchmarkMutex-8 30000000 56.2 ns/op 0 B/op 0 allocs/op
BenchmarkMutexSlack-8 20000000 68.4 ns/op 0 B/op 0 allocs/op
BenchmarkMutexWork-8 20000000 84.4 ns/op 0 B/op 0 allocs/op
BenchmarkMutexWorkSlack-8 20000000 106 ns/op 0 B/op 0 allocs/op
BenchmarkMutexNoSpin-8 10000000 203 ns/op 0 B/op 0 allocs/op
BenchmarkMutexSpin-8 2000000 736 ns/op 0 B/op 0 allocs/op
BenchmarkOnce-8 2000000000 0.95 ns/op 0 B/op 0 allocs/op
BenchmarkPool-8 300000000 4.67 ns/op 0 B/op 0 allocs/op
BenchmarkPoolOverflow-8 2000000 902 ns/op 0 B/op 0 allocs/op
BenchmarkSemaUncontended-8 500000000 3.94 ns/op 0 B/op 0 allocs/op
BenchmarkSemaSyntNonblock-8 20000000 118 ns/op 0 B/op 0 allocs/op
BenchmarkSemaSyntBlock-8 20000000 86.2 ns/op 0 B/op 0 allocs/op
BenchmarkSemaWorkNonblock-8 20000000 115 ns/op 0 B/op 0 allocs/op
BenchmarkSemaWorkBlock-8 20000000 103 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexUncontended-8 100000000 12.7 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWrite100-8 20000000 75.7 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWrite10-8 50000000 37.3 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWorkWrite100-8 10000000 137 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWorkWrite10-8 10000000 203 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupUncontended-8 300000000 4.28 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupAddDone-8 30000000 52.2 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupAddDoneWork-8 30000000 53.1 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupWait-8 2000000000 0.80 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupWaitWork-8 100000000 10.2 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupActuallyWait-8 20000000 106 ns/op 16 B/op 1 allocs/op
PASS
ok sync 105.167s
mbp 2013 results
- CPU: Intel Core i7-4850HQ @ 2.30GHz
- RAM: 16 GB 1600 MHz DDR3
goos: darwin
goarch: amd64
pkg: sync
BenchmarkCond1-8 5000000 250 ns/op 0 B/op 0 allocs/op
BenchmarkCond2-8 1000000 1701 ns/op 0 B/op 0 allocs/op
BenchmarkCond4-8 500000 3772 ns/op 0 B/op 0 allocs/op
BenchmarkCond8-8 300000 4372 ns/op 0 B/op 0 allocs/op
BenchmarkCond16-8 200000 7380 ns/op 0 B/op 0 allocs/op
BenchmarkCond32-8 100000 16179 ns/op 0 B/op 0 allocs/op
BenchmarkLoadMostlyHits/*sync_test.DeepCopyMap-8 100000000 15.2 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyHits/*sync_test.RWMutexMap-8 30000000 59.5 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyHits/*sync.Map-8 100000000 16.3 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyMisses/*sync_test.DeepCopyMap-8 100000000 10.2 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyMisses/*sync_test.RWMutexMap-8 20000000 66.6 ns/op 7 B/op 0 allocs/op
BenchmarkLoadMostlyMisses/*sync.Map-8 100000000 10.6 ns/op 7 B/op 0 allocs/op
BenchmarkLoadOrStoreBalanced/*sync_test.RWMutexMap-8 3000000 499 ns/op 71 B/op 2 allocs/op
BenchmarkLoadOrStoreBalanced/*sync.Map-8 3000000 408 ns/op 70 B/op 3 allocs/op
BenchmarkLoadOrStoreUnique/*sync_test.RWMutexMap-8 2000000 829 ns/op 178 B/op 2 allocs/op
BenchmarkLoadOrStoreUnique/*sync.Map-8 2000000 845 ns/op 163 B/op 4 allocs/op
BenchmarkLoadOrStoreCollision/*sync_test.DeepCopyMap-8 200000000 6.71 ns/op 0 B/op 0 allocs/op
BenchmarkLoadOrStoreCollision/*sync_test.RWMutexMap-8 10000000 174 ns/op 0 B/op 0 allocs/op
BenchmarkLoadOrStoreCollision/*sync.Map-8 200000000 8.20 ns/op 0 B/op 0 allocs/op
BenchmarkRange/*sync_test.DeepCopyMap-8 500000 3766 ns/op 0 B/op 0 allocs/op
BenchmarkRange/*sync_test.RWMutexMap-8 20000 65936 ns/op 16384 B/op 1 allocs/op
BenchmarkRange/*sync.Map-8 300000 3979 ns/op 0 B/op 0 allocs/op
BenchmarkAdversarialAlloc/*sync_test.DeepCopyMap-8 2000000 839 ns/op 534 B/op 1 allocs/op
BenchmarkAdversarialAlloc/*sync_test.RWMutexMap-8 20000000 69.1 ns/op 8 B/op 1 allocs/op
BenchmarkAdversarialAlloc/*sync.Map-8 5000000 372 ns/op 50 B/op 1 allocs/op
BenchmarkAdversarialDelete/*sync_test.DeepCopyMap-8 10000000 211 ns/op 168 B/op 1 allocs/op
BenchmarkAdversarialDelete/*sync_test.RWMutexMap-8 20000000 81.9 ns/op 25 B/op 1 allocs/op
BenchmarkAdversarialDelete/*sync.Map-8 20000000 67.1 ns/op 15 B/op 1 allocs/op
BenchmarkUncontendedSemaphore-8 100000000 20.9 ns/op 0 B/op 0 allocs/op
BenchmarkContendedSemaphore-8 20000000 86.8 ns/op 0 B/op 0 allocs/op
BenchmarkMutexUncontended-8 500000000 3.45 ns/op 0 B/op 0 allocs/op
BenchmarkMutex-8 20000000 85.0 ns/op 0 B/op 0 allocs/op
BenchmarkMutexSlack-8 20000000 81.3 ns/op 0 B/op 0 allocs/op
BenchmarkMutexWork-8 10000000 122 ns/op 0 B/op 0 allocs/op
BenchmarkMutexWorkSlack-8 10000000 121 ns/op 0 B/op 0 allocs/op
BenchmarkMutexNoSpin-8 5000000 245 ns/op 0 B/op 0 allocs/op
BenchmarkMutexSpin-8 1000000 1051 ns/op 0 B/op 0 allocs/op
BenchmarkOnce-8 2000000000 1.08 ns/op 0 B/op 0 allocs/op
BenchmarkPool-8 300000000 4.52 ns/op 0 B/op 0 allocs/op
BenchmarkPoolOverflow-8 2000000 961 ns/op 0 B/op 0 allocs/op
BenchmarkSemaUncontended-8 300000000 4.16 ns/op 0 B/op 0 allocs/op
BenchmarkSemaSyntNonblock-8 10000000 175 ns/op 0 B/op 0 allocs/op
BenchmarkSemaSyntBlock-8 10000000 156 ns/op 0 B/op 0 allocs/op
BenchmarkSemaWorkNonblock-8 10000000 156 ns/op 0 B/op 0 allocs/op
BenchmarkSemaWorkBlock-8 10000000 150 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexUncontended-8 100000000 13.1 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWrite100-8 20000000 109 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWrite10-8 20000000 63.0 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWorkWrite100-8 10000000 215 ns/op 0 B/op 0 allocs/op
BenchmarkRWMutexWorkWrite10-8 5000000 268 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupUncontended-8 300000000 4.60 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupAddDone-8 20000000 76.9 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupAddDoneWork-8 20000000 68.1 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupWait-8 2000000000 0.77 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupWaitWork-8 200000000 9.38 ns/op 0 B/op 0 allocs/op
BenchmarkWaitGroupActuallyWait-8 20000000 102 ns/op 16 B/op 1 allocs/op
PASS
ok sync 102.326s