Hi Lee,
Thanks for pointing out my misuse of words.
I've actually borne in mind that parallelism and concurrency are different
things, but I made a slip.
I'll try to be more careful next time.
On Tuesday, 17 April 2018 04:09:06 UTC+8, Lee Painton wrote:
>
> Also, as Rob Pike has stressed in th
Thanks Andrey.
I did realize the overhead of goroutines, but I didn't realize it was this
large.
Your version is better, but it can't output results sequentially, sorting
it before output is easy anyway.
One new thing I learned from your code is that channels can be reused. I
thought every go
Also, as Rob Pike has stressed in the past, concurrency is not
parallelism. Concurrency is a design principle that enables parallelism,
but goroutines are concurrency constructs and do not automatically run in
parallel.
On Monday, April 16, 2018 at 12:47:18 PM UTC-4, andrey mirtchovski wrote:
In short, your concurrency is too fine-grained. Adding concurrency
primitives requires locking which is expensive, and creating a lot of
goroutines does consume resources, even if we consider it relatively
cheap.
If you slice the problem slightly differently it can be made faster:
one goroutine pe
Hi all,
As a newbie I tried to implement a simple program calculating the Catalan
numbers, which are the numbers satisfying the recursion equation c(1) = 1;
c(n) = c(n - 1) * c(1) + c(n - 2) * c(2) + ... c(1) * c(n).
At first, I implemented it without channels:
package main
import (
"fmt"