Improving performance in programs should usually be driven by measured data. But we cannot base program tuning only on data, as the initial design and later improvement of the program already needs to take performance into account. To think about performance it is important to have a useful mental model of the performance characteristics of common operations, so that we can build complex and fast programs out of them.
Modern computer systems are quite complicated, with multi-level caches, sophisticated pipelines, interconnects, and other non obvious performance characteristics. Classic mental models for performance, like the O(n) notation for algorithms, are often overly simplistic to properly deal with this complicated world.
On the other hand the mental models cannot exist on their own, but have to be informed and calibrated by performance measurements, such as data from performance counters, and tracing information. Modern systems have many ways to gather data, so it is important to use structured methodologies to focus on the important information.
This talk gives an overview of some useful mental models to tune programs for modern CPUs, focusing on caching performance, and how to efficiently calibrate the mental models with modern profiling methodologies using performance counters and tracing functionality on Intel CPUs.
The audience is programmers who are interested in low-level performance tuning.