|
|
|
|
|
by emperorcezar
2930 days ago
|
|
It only does because the author is testing for their specific environment. At some number of cores, the concurrent calls will produce more performant code than running sequentially. Ideally, in this case I would think one would want to check the number of cores and decide what route to take. |
|
For the point at which the author removed parallelism, and the sequential code was faster, I think this was the case. The computation was too fine-grain. The author successfully took advantage of parallelism by applying it at a coarser granularity; each thread did more work. At this point, the author also does tune the solution for the execution environment, as he uses a fixed set of go-routines to process a bunch of messages rather than one go-routine per message.