Measuring cache misses on macOS with Instruments
I couldn't find many resources online that showed how to see cache misses on macOS. I thought I'd learn a bit about Instruments, throw some toy problems at it, and write about the experience in a blog post. These toy examples - iterating sequentially then randomly, summing elements in a matrix, naive vs tiled matmul and iterating AoS vs SoA - are great to see some real numbers from L1 data cache misses, but they're far away from real programming problems. What's your experience using tools like Instruments/perf/cachegrind to actually optimize an algorithm? Is it ever needed to measure this at the hardware counter level or can you get away with intuition about the size of your data structure, how it's been accessed and using basic timers? submitted by /u/markuzo1 [link] [留言]