3 ms·
RWMutex (or Mutex if every op is a write op) is faster since it's just a couple counters and atomic AddInt. Channels are more intuitive for some tasks, and less
by thirsteh 12y ago
RWMutex (or Mutex if every op is a write op) is faster since it's just a couple counters and atomic AddInt. Channels are more intuitive for some tasks, and less for others. Don't try to use channels anywhere, especially when you're just synchronizing access to something.
Source: Have written and benchmarked many, many Go programs.