On Tue, 20 Aug 2019, at 9:33 AM, changkun wrote: > Hi Robert, > > Thanks for your explanation. But how could I "logged the number of operations > done per Go routine", which particular debug settings you referring to? > It is reasonable that sync.Mutex rely on runtime scheduler but channels do > not. However, it is unclear why a significant performance drop appears. Is it > possible to determine when the performance will appear?
This comment by Dmitry Vyukov on a very old issue might help (I have no idea if it is still valid after 6 years though) If you are interested why chan does not have the same issue, runtime handles chan's in a special way (active/passive spinning + thread parking instead of goroutine parking), because it knowns that the critical section is bounded and small. For sync.Mutex it does not have any knowledge as to critical section size. See https://github.com/golang/go/issues/5183 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/55e8058b-cf7e-40c5-a81e-c3643a4ba507%40www.fastmail.com.