Master the fundamental concepts of profiling & measurement through this focused micro-challenge.
Google Benchmark, LLVM's llvm-exegesis, and Julia's @benchmark all share the same skeleton: warmup, many timed iterations, then aggregate statistics. Without warmup, first-touch page faults and cold icache skew the first samples. Without variance reporting, a lucky 5% speedup from turbo noise looks like a win.
Separate setup from the timed body. Loop enough iterations that timer overhead is below 1% of measured time. Track min, median, and standard deviation.
cLoading…
-O2 or -O3 unless you explicitly test debug behaviorvolatile or blackhole sinksKeep 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 build a microbenchmark harness with configurable warmup and iteration counts plus mean/min output. This exercise requires honest statistics so you can tell signal from measurement noise.
Implement microbenchmark framework with warmup, statistics, and comparison.
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