Master the fundamental concepts of profiling & measurement through this focused micro-challenge.
Modern CPUs expose performance-monitoring units (PMUs) that count cycles, instructions retired, last-level cache misses, and branch mispredictions. Intel VTune, perf, and likwid all read the same counters. A loop can look innocent in source yet retire few instructions per cycle because cache misses dominate.
Cycles measure wall time on CPU. cache-misses at LLC level often explain memory-bound loops. branch-misses spike when data-dependent branches defeat the predictor.
bashLoading…
perf list shows events your CPU actually supportsperf annotateKeep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will run perf stat on two versions of the same algorithm and compare cycles, cache misses, and branch misses. This exercise requires you to connect counter deltas to specific code changes, not just report raw numbers.
Demonstrate understanding of CPU performance counters and their impact on performance.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github