package
0.0.0-20241126132414-a6474f9c9b52
Repository: https://github.com/talgat-ruby/exercises-go.git
Documentation: pkg.go.dev
# README
Problem 2
addConcurrently
needs to be implemented concurrently:
- Utilize all cores on machine (Advanced concept)
- Divide the input into parts
- Run computation for each part in separate goroutine.
This is an optional problem which involves runtime
package and includes benchmark tests.
Because of nature of benchmark tests, I can only share my results:
$ go test -v -bench=. -race ./exercise4/problem2/...
=== RUN TestAdd
--- PASS: TestAdd (0.10s)
goos: darwin
goarch: arm64
pkg: github.com/talgat-ruby/exercises-go/exercise4/problem2
BenchmarkAdd
BenchmarkAdd-8 20 55690504 ns/op
BenchmarkAddConcurrent
BenchmarkAddConcurrent-8 45 25124303 ns/op
PASS
ok github.com/talgat-ruby/exercises-go/exercise4/problem2 6.019s