Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(301)

Issue 9730043: code review 9730043: runtime: allocate chan in 2 allocations (Hchan and user... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by dvyukov
Modified:
12 years ago
Reviewers:
rsc
Visibility:
Public.

Description

runtime: 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/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+57 lines, -86 lines) Patch
M src/cmd/gc/reflect.c View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M src/pkg/reflect/type.go View 1 2 4 chunks +15 lines, -8 lines 0 comments Download
M src/pkg/runtime/chan.c View 1 2 3 4 5 6 4 chunks +7 lines, -11 lines 0 comments Download
M src/pkg/runtime/chan_test.go View 1 2 3 4 5 1 chunk +33 lines, -5 lines 0 comments Download
M src/pkg/runtime/malloc.h View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/mgc0.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M src/pkg/runtime/mgc0.c View 1 2 3 4 5 6 7 chunks +1 line, -58 lines 0 comments Download

Messages

Total messages: 9
dvyukov
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
12 years, 1 month ago (2013-05-24 16:40:29 UTC) #1
iant
This is a simplification but I'm not sure whether it is a good idea or ...
12 years, 1 month ago (2013-05-31 22:02:49 UTC) #2
dave_cheney.net
I'm not sure this is a good idea, we've had a lot of permutations for ...
12 years, 1 month ago (2013-05-31 23:06:26 UTC) #3
dvyukov
https://codereview.appspot.com/9730043/diff/15001/src/pkg/runtime/chan.c File src/pkg/runtime/chan.c (right): https://codereview.appspot.com/9730043/diff/15001/src/pkg/runtime/chan.c#newcode111 src/pkg/runtime/chan.c:111: n = sizeof(*c); On 2013/05/31 22:02:49, iant wrote: > ...
12 years, 1 month ago (2013-06-01 20:11:01 UTC) #4
dvyukov
On 2013/05/31 23:06:26, dfc wrote: > I'm not sure this is a good idea, we've ...
12 years, 1 month ago (2013-06-01 20:12:18 UTC) #5
dvyukov
https://codereview.appspot.com/9730043/diff/15001/src/cmd/gc/reflect.c File src/cmd/gc/reflect.c (right): https://codereview.appspot.com/9730043/diff/15001/src/cmd/gc/reflect.c#newcode1104 src/cmd/gc/reflect.c:1104: ot = duintptr(s, ot, GC_APTR); On 2013/05/31 22:02:49, iant ...
12 years, 1 month ago (2013-06-01 20:15:28 UTC) #6
rsc
NOT LGTM It's fine to split the channel into two allocated blocks to make garbage ...
12 years, 1 month ago (2013-06-03 20:14:15 UTC) #7
dvyukov
On 2013/06/03 20:14:15, rsc wrote: > NOT LGTM > > It's fine to split the ...
12 years ago (2013-07-18 14:26:52 UTC) #8
dvyukov
12 years ago (2013-07-18 14:27:24 UTC) #9
*** Abandoned ***
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b