4 ms·
Go can't be really mono-threaded unless you are trying to do so (or your program is really short). A lot of the standard operations under the hood are in fact
by mackwic 13y ago
Go can't be really mono-threaded unless you are trying to do so (or your program is really short).
A lot of the standard operations under the hood are in fact executed in goroutines in a pool of threads. IOs are, for example. So you found yourself gaining all the advantage of asynchronism without supporting the cost in the code... exactly like this example in Java.
- yelnatz 13y agoI think he forgot to set GOMAXPROCS.
- MetaCosm 13y agohttp://golang.org/doc/faq http://golang.org/doc/faq Why doesn't my multi-goroutine program use multiple CPUs? You must set the GOMAXPROCS shell environment variable or use the similarly-named function of the runtime package to allow the run-time support to utilize more than one OS thread. Programs that perform parallel computation should benefit from an increase in GOMAXPROCS. However, be aware that concurrency is not parallelism.