TGViewer
Go Go @golang · 19.2K subscribers
Post #164 25.6K
Are Atomic Operations Faster and Better Than a Mutex? It Depends

From the author:
"Recently, while reviewing a pull request, a discussion arose about using sync/atomic versus sync.RWMutex.
It’s a question that comes up often when writing concurrent Go code, so I thought it would make a great post"

https://madflojo.dev/posts/are-atomic-operations-faster-than-a-mutex/
  • ❤ 73
  • 👍 37
  • 🤔 31
  • 👏 29
  • 🔥 26
  • 💩 24
  • 🤯 14
  • 👎 9
More from @golang
  1. Oct 1, 2026It's been a while... Everything is going agentic, so there is rather an interesting projec…
  2. Mar 20, 2026If you’re working with Go and care about performance, then check out the https://goperf.de…
  3. Nov 29, 2025Hello, folks, it's been a while. Re-sharing an interetsting recording from GopherCon 2025:…
  4. Aug 18, 2025Be Careful with Go Struct Embedding Embedding structs can quietly mask deeper-nested field…
  5. May 31, 2025What's new in Go: Google I/O presentation https://www.youtube.com/watch?v=kj80m-umOxs&ab_c…
  6. Feb 9, 2025Go 1.24: A Major Improvement for Tooling: go tools 🛠 Hello, folks! The upcoming Go 1.24 (…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →