Skip to main content
← Lab

atomcliff

confirmedshipC · Apple M4Systems & data structuresJuly 17, 2026

the question

Does a single shared atomic counter scale negatively on M4 while per-thread padded counters scale linearly, and is cross-cluster contention worse?

what came out

A shared relaxed fetch_add scales negatively: two threads (260 Mops/s) are slower than one (542), and eight run at 37, about a fourteenth of one thread. Per-thread padded counters scale linearly to 4157 Mops/s at eight (112x). Cross-cluster sharing is worse still (31 vs 37). No updates are lost.

method & receipts

  • Result: confirmed
  • Pre-registered the prediction was written down and committed before the run.
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/atomcliff