Does anyone know approximately what the minimum work size is needed in order for a goroutine to be beneficial (assuming that there are free cores for the work to be offloaded to)?
I've been plodding through project euler with Go. While I don't have a definite answer for you I found the goroutine-based primality sieve in the Go docs to be an order of magnitude slower than simply checking each number for primality. Setting GOMAXPROCS to a higher value didn't help, either.
goroutine is an abstraction that you use if it helps you model your application better. You're doing concurrency oriented programming, so think about the parts of your application that have concurrency within them.
Think about an OO system and imagine asking the same question about whether you should instantiate an object.
Do the thing that makes sense first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With