<aside> 🐝

We should always profile code to find true bottlenecks instead of guessing what might be slow

</aside>

Quantifying Performance

Amdahl’s Law: The Law of Diminishing Returns

$$ \text{Speedup: } \frac{1}{(1-f)+(\frac{f}{s})} $$

image.png

Tools for Measurement and Profiling

Tool Type Examples
Software Timers time command, gettimeofday() times()
Hardware Timers rdtsc instruction (read time stamp counter)
Hardware Performance Counters perf, Intel VTune
Instrumentation and Profiling gprof, gcov, Valgrind