Descriptionruntime: allocate chan in 2 allocations (Hchan and user buffer)
Several reasons for this change:
1. Simplify GC code.
2. Allows lazy chan buffer allocations (i.e. chan(int, 1e7)).
3. Allow bitmask-based GC (otherwise it's unclear how to handle chans,
because it's not a struct and not an array).
Benchmarks results are noisy.
chan(int) allocation is faster because it does not need to call setype(),
it just sets FlagNoPointers during mallocgc().
benchmark old ns/op new ns/op delta
BenchmarkChanUncontended 55 56 +0.90%
BenchmarkChanUncontended-2 29 28 -1.37%
BenchmarkChanUncontended-4 19 19 +1.02%
BenchmarkChanUncontended-8 14 12 -18.12%
BenchmarkChanContended 60 56 -6.66%
BenchmarkChanContended-2 181 137 -24.31%
BenchmarkChanContended-4 359 338 -5.85%
BenchmarkChanContended-8 344 377 +9.59%
BenchmarkChanSync 124 127 +2.42%
BenchmarkChanSync-2 443 481 +8.58%
BenchmarkChanSync-4 417 479 +14.87%
BenchmarkChanSync-8 391 381 -2.56%
BenchmarkChanProdCons0 128 133 +3.91%
BenchmarkChanProdCons0-2 278 301 +8.27%
BenchmarkChanProdCons0-4 709 704 -0.71%
BenchmarkChanProdCons0-8 1007 1058 +5.06%
BenchmarkChanProdCons10 82 78 -4.50%
BenchmarkChanProdCons10-2 327 299 -8.56%
BenchmarkChanProdCons10-4 697 689 -1.15%
BenchmarkChanProdCons10-8 755 779 +3.18%
BenchmarkChanProdCons100 62 62 -0.16%
BenchmarkChanProdCons100-2 201 169 -15.92%
BenchmarkChanProdCons100-4 395 414 +4.81%
BenchmarkChanProdCons100-8 395 447 +13.16%
BenchmarkChanProdConsWork0 653 649 -0.61%
BenchmarkChanProdConsWork0-2 391 410 +4.86%
BenchmarkChanProdConsWork0-4 686 656 -4.37%
BenchmarkChanProdConsWork0-8 1029 1105 +7.39%
BenchmarkChanProdConsWork10 603 601 -0.33%
BenchmarkChanProdConsWork10-2 523 441 -15.68%
BenchmarkChanProdConsWork10-4 879 962 +9.44%
BenchmarkChanProdConsWork10-8 1142 1332 +16.64%
BenchmarkChanProdConsWork100 584 582 -0.34%
BenchmarkChanProdConsWork100-2 501 495 -1.20%
BenchmarkChanProdConsWork100-4 926 959 +3.56%
BenchmarkChanProdConsWork100-8 1013 1140 +12.54%
BenchmarkChanCreation 97 77 -20.53%
BenchmarkChanCreation-2 114 91 -19.74%
BenchmarkChanCreation-4 84 74 -12.38%
BenchmarkChanCreation-8 90 73 -18.89%
BenchmarkChanCreationBuffered 128 143 +11.72%
BenchmarkChanCreationBuffered-2 219 183 -16.44%
BenchmarkChanCreationBuffered-4 159 123 -22.64%
BenchmarkChanCreationBuffered-8 199 158 -20.60%
BenchmarkChanCreationBufferedPtr 139 158 +13.67%
BenchmarkChanCreationBufferedPtr-2 234 225 -3.85%
BenchmarkChanCreationBufferedPtr-4 167 191 +14.37%
BenchmarkChanCreationBufferedPtr-8 191 165 -13.61%
BenchmarkChanSem 55 53 -4.67%
BenchmarkChanSem-2 55 52 -4.51%
BenchmarkChanSem-4 55 52 -4.35%
BenchmarkChanSem-8 55 52 -4.35%
Patch Set 1 #Patch Set 2 : diff -r bcd566b5492c https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 3 : diff -r bcd566b5492c https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 4 : diff -r bcd566b5492c https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 5 : diff -r ac183442f328 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 6 : diff -r ac183442f328 https://dvyukov%40google.com@code.google.com/p/go/ #
Total comments: 10
Patch Set 7 : diff -r e3f2b59f2404 https://dvyukov%40google.com@code.google.com/p/go/ #
MessagesTotal messages: 9
|