From 56c8ef37f4c8ca5ada63cc642954c030a2822210 Mon Sep 17 00:00:00 2001 From: Aidan Date: Tue, 11 May 2021 18:12:15 -0400 Subject: [PATCH 1/2] fixed go.go to properly select over channels during put in select_both --- crossbeam-channel/benchmarks/go.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crossbeam-channel/benchmarks/go.go b/crossbeam-channel/benchmarks/go.go index 66daf3c0a..121ab4503 100644 --- a/crossbeam-channel/benchmarks/go.go +++ b/crossbeam-channel/benchmarks/go.go @@ -136,16 +136,21 @@ func select_both(cap int) { var c3 = make(chan Message, cap) var done = make(chan bool) - var producer = func(c chan Message) { + var producer = func(c0 chan Message, c1 chan Message, c2 chan Message, c3 chan Message) { for i := 0; i < MESSAGES / THREADS; i++ { - c <- Message(i) + select { + case c0 <- Message(i); + case c1 <- Message(i); + case c2 <- Message(i); + case c3 <- Message(i); + } } done <- true } - go producer(c0) - go producer(c1) - go producer(c2) - go producer(c3) + go producer(c0,c1,c2,c3) + go producer(c0,c1,c2,c3) + go producer(c0,c1,c2,c3) + go producer(c0,c1,c2,c3) for t := 0; t < THREADS; t++ { go func() { From 64d8763d22bc62f48d3ff1a708299f6c68de346a Mon Sep 17 00:00:00 2001 From: Aidan Date: Tue, 11 May 2021 22:35:20 -0400 Subject: [PATCH 2/2] go uses :'s --- crossbeam-channel/benchmarks/go.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crossbeam-channel/benchmarks/go.go b/crossbeam-channel/benchmarks/go.go index 121ab4503..2d65bcbe1 100644 --- a/crossbeam-channel/benchmarks/go.go +++ b/crossbeam-channel/benchmarks/go.go @@ -139,10 +139,10 @@ func select_both(cap int) { var producer = func(c0 chan Message, c1 chan Message, c2 chan Message, c3 chan Message) { for i := 0; i < MESSAGES / THREADS; i++ { select { - case c0 <- Message(i); - case c1 <- Message(i); - case c2 <- Message(i); - case c3 <- Message(i); + case c0 <- Message(i): + case c1 <- Message(i): + case c2 <- Message(i): + case c3 <- Message(i): } } done <- true