4 ms·
In Go, while it is possible to use a concurrent hash map, it's generally not recommended. In most cases, you should use a channel. In one of my first Go progra
by idoubtit 4y ago
In Go, while it is possible to use a concurrent hash map, it's generally not recommended. In most cases, you should use a channel.
In one of my first Go programs, I used mutexes to avoid concurrent writes in a critical part. Then I moved the writing process into a goroutine that receives its input through a channel of size 1. In my case, the later code was easier to maintain and more performant than the former, mutex-based, code.