Descriptionruntime: fine-grained locking in select
Never lock more than one channel at a time.
Also makes lockorder and channel sorting unnecessary.
Details of the algorithm are in comments.
benchmark old ns/op new ns/op delta
BenchmarkSelectUncontended 213 188 -11.74%
BenchmarkSelectUncontended-2 110 97.2 -11.64%
BenchmarkSelectUncontended-4 56.2 49.5 -11.92%
BenchmarkSelectUncontended-8 29.7 25.9 -12.79%
BenchmarkSelectUncontended-16 17.3 16.4 -5.20%
BenchmarkSelectUncontended-32 13.7 11.4 -16.79%
BenchmarkSelectSyncContended 795 710 -10.69%
BenchmarkSelectSyncContended-2 946 710 -24.95%
BenchmarkSelectSyncContended-4 1791 1187 -33.72%
BenchmarkSelectSyncContended-8 1749 637 -63.58%
BenchmarkSelectSyncContended-16 2109 563 -73.30%
BenchmarkSelectSyncContended-32 3165 1172 -62.97%
BenchmarkSelectAsyncContended 231 208 -9.96%
BenchmarkSelectAsyncContended-2 671 209 -68.85%
BenchmarkSelectAsyncContended-4 395 215 -45.57%
BenchmarkSelectAsyncContended-8 451 240 -46.78%
BenchmarkSelectAsyncContended-16 486 233 -52.06%
BenchmarkSelectAsyncContended-32 861 395 -54.12%
BenchmarkSelectNonblock 126 36.0 -71.43%
BenchmarkSelectNonblock-2 155 17.6 -88.65%
BenchmarkSelectNonblock-4 285 8.45 -97.04%
BenchmarkSelectNonblock-8 212 4.41 -97.92%
BenchmarkSelectNonblock-16 180 2.44 -98.64%
BenchmarkSelectNonblock-32 395 1.63 -99.59%
BenchmarkSelectProdCons 1140 926 -18.77%
BenchmarkSelectProdCons-2 653 545 -16.54%
BenchmarkSelectProdCons-4 519 352 -32.18%
BenchmarkSelectProdCons-8 667 372 -44.23%
BenchmarkSelectProdCons-16 751 431 -42.61%
BenchmarkSelectProdCons-32 1142 583 -48.95%
Patch Set 1 #Patch Set 2 : diff -r 141e6dead8db https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 3 : diff -r c0a68bcf19ae https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 4 : diff -r c0a68bcf19ae https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 5 : diff -r c0a68bcf19ae https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 6 : diff -r 67f9ef140028 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 7 : diff -r 67f9ef140028 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 8 : diff -r 03b003455359b09fff0f1662255dc5fe10b93290 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 9 : diff -r 03b003455359b09fff0f1662255dc5fe10b93290 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 10 : diff -r 03b003455359b09fff0f1662255dc5fe10b93290 https://dvyukov%40google.com@code.google.com/p/go/ #
MessagesTotal messages: 7
|