problem2

package
v0.0.0-...-cb75c49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 0 Imported by: 0

README

Problem 2

addConcurrently needs to be implemented concurrently:

  1. Utilize all cores on machine (Advanced concept)
  2. Divide the input into parts
  3. 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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL