Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>No locks.

I'm sure the author means there's no explicit locking done by the programmer, but readers should be aware that channels are actually implemented internally using locks (which are 4x slower than using a sync.Mutex yourself).



>channels are actually implemented internally using locks (which are 4x slower than using a sync.Mutex yourself).

Is that for both buffered and non-buffered channels?


Channels are implemented using locks, but "4x slower" is a meaningless microbenchmark number.


You're welcome to benchmark it yourself. I got it from [1] which is a pretty recent comparison.

[1] http://www.jtolds.com/writing/2016/03/go-channels-are-bad-an...


GP said meaningless, not wrong


I found switching from channels to plain ol' queues to be an enormous performance improvement in a program sending hundreds of millions of messages, though I do agree in general that most programmers won't need to care about it.

The program was a financial model backtesting framework which I ended up rewriting in Rust because Go was simply too slow for what I wanted to do.



This is great, thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: