C++ Application Performance: From Theory to Practice
C++ Application Performance: From Theory to Practice
Summary:
The book "C++ Application Performance" is a practical guide for developers who want to get the most out of their code. Unlike textbooks on the basics of the language, this book focuses on bottlenecks, hardware features, and modern optimization techniques used in high-load systems, game engines, financial applications, and embedded development.
Who is this book for?
- For C++ developers with 2+ years of experience who want to level up.
- For engineers working on latency-sensitive applications (trading systems, streaming, real-time graphics).
- For technical leads making architectural decisions regarding performance.
- For senior students studying systems programming.
What you will learn from the book:
- Profiling: how to properly use perf, Valgrind, Intel VTune, Google Benchmark. You will learn to find real bottlenecks instead of guessing.
- Memory: cache misses, data alignment, memory pools, custom allocators. Learn why std::vector can be faster than std::list even with frequent insertions.
- Algorithms and Data Structures: choosing the right container, optimizing hash tables, flat containers, using SOA (Struct of Arrays) instead of AOS.
- Parallelism: lock-free structures, atomic operations, proper use of std::async and thread pools. Avoiding data races and false sharing.
- Compiler: how to read assembly listings, optimization flags, __restrict hints, likely/unlikely, macros for branch prediction.
- Modern C++: move semantics, copy elision, constexpr and metaprogramming for compile-time computations.
The book is structured on the principle of "from problem to solution." Each chapter begins with a real example of slow code, followed by an analysis of the causes and step-by-step optimization with speed measurements. All examples are available on GitHub and tested on GCC and Clang under Linux and Windows.
Special attention is given to techniques that work on modern processors (Skylake, Zen 3/4, Apple Silicon). You will learn why some optimizations yield a 10x speedup while others are useless, and how not to waste time on "optimization for the sake of optimization."
This book is not a reference guide, but a working tool. After reading it, you will be able to confidently profile any project, find bottlenecks, and eliminate them without sacrificing code readability. Recommended for those who already write in C++ and want to do it faster.