Go Perf False Sharing

Guides eliminating false sharing in Go — when goroutines on different cores mutate distinct variables sharing one 64-byte cache line, the coherence protocol ping-pongs the line and serializes them with no lock. Owns the symptom (a sharded counter that scales worse as cores grow), the fix (pad hot per-core fields with cpu.CacheLinePad), and measuring. Fires on "false sharing", "sharded counter doesn't scale", "per-core array slow". Routes packing to go-perf-struct-layout, sharding to go-perf-contention-and-sharding.

ctoth 01ac372 3 files · 27.8 KB Updated

File contents

ctoth/golang-skills-plugin/tree/main/plugins/performant-golang/skills/go-perf-false-sharing commit 01ac37266b

Frequently asked questions

npx skillmds@latest add ctoth/go-perf-false-sharing