gcp
github.com/drgrib/go_concurrency_patterns_2012
go get github.com/drgrib/go_concurrency_patterns_2012
gcp

github.com/drgrib/go_concurrency_patterns_2012

Ordered, complete, and sometimes enhanced versions of code from Rob Pike's 2012 talk

go get github.com/drgrib/go_concurrency_patterns_2012
Readme

Google I/O 2012 - Go Concurrency Patterns Code

The code in this repository implements and orders all the major code examples referenced in Rob Pike's talk found here.

I have refactored it for clarity when possible as well as implemented enhancements.

Enhancements

Variadic and Slice Versions of fanIn Function

In the talk, Pike only covers a version of fanIn with a set number of two input channels. I implement two versions that can accept an arbitrary number of channels:

  • variadicFanIn in 07_variadicFanIn.go
  • sliceFanIn in 08_sliceFanIn.go

In 11_sliceSelect.go, I iterate on this to have one just call the other.

Slice select

Pike only covers use of select for a set number of channels. I implement a select on an arbitrarily sized slice of input channels in 11_sliceSelect.go.

Google 3.5

Pike gets to Google 3.0 in his talk, which uses two replicas of each type of his simulated Google search. On my machine, this version still regularly failed the 80ms timeout. So I created a version in 17_googleSearch.go called Google3_5 that uses slices of 10 replicas per type and, not surprisingly, gets better performance than Pike's final version in the talk, sometimes sub-millisecond on my machine.

GitHub Stars

11

LAST COMMIT

5yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.0.0-20170410183043-698eaff6b661
1yr ago
No alternatives found
No tutorials found
Add a tutorial