Show HN:macOS Memory Benchmark for Apple Silicon (cache, bandwidth, latency)(github.com)
github.com
Show HN:macOS Memory Benchmark for Apple Silicon (cache, bandwidth, latency)
https://github.com/timoheimonen/macOS-memory-benchmark
4 comments
Built a small macOS memory benchmark for Apple Silicon.
Measures cache latency (pointer chase) and memory bandwidth (read/write/copy). ARM64-native.
Looking for feedback on methodology and results across different M-series chips. I have been able to test this on M4 Mac mini and M1 MacBook Air.
Can be installed with Brew.
Measures cache latency (pointer chase) and memory bandwidth (read/write/copy). ARM64-native.
Looking for feedback on methodology and results across different M-series chips. I have been able to test this on M4 Mac mini and M1 MacBook Air.
Can be installed with Brew.
A quick clarification: on Apple Silicon there is no user-space equivalent of x86 CLFLUSH, so the benchmark can’t force cold caches between runs. Cache behavior is inferred via buffer sizing, warm-up, and steady-state measurements.
From the memory access patterns, the biggest architectural difference seems to be prefetch behavior.
M4 appears to use a much more aggressive prefetcher that strongly assumes forward-linear access and delivers very high bandwidth when that assumption holds, but performance drops sharply when the access pattern breaks.
M1 is more conservative, with lower peak bandwidth but more consistent performance across different access directions and patterns.
Macbook Air M1 Bandwidth & latency:
Main Memory Bandwidth Tests (multi-threaded, 8 threads):
Main Memory Latency Test (single-threaded, pointer chase):
Macbook Air M1 Patterns:
Sequential Forward:
Sequential Reverse:
Strided (Cache Line - 64B):
Strided (Page - 4096B):
Random Uniform:
Mac Mini M4 Bandwidth & Latency:
Main Memory Bandwidth Tests (multi-threaded, 10 threads):
Main Memory Latency Test (single-threaded, pointer chase):
Mac Mini M4 Patterns:
Sequential Forward:
Sequential Reverse:
Strided (Cache Line - 64B):
Strided (Page - 4096B):
Random Uniform: