fenbf/AwesomePerfCpp
Tentang
Daftar pilihan sumber daya pengoptimalan performa C/C++ yang keren: presentasi, artikel, buku, pustaka, alat, situs, dan blog. Terinspirasi oleh awesome.
Alat pengembanganPertumbuhan bintang terukur
- dalam 24 jam
- +9
- dalam 7 hari
- +9
- dalam 15 hari
- +10
- dalam 1 bulan
- +10
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliAwesomePerfCpp
Talks, articles, books, libraries, and tools for measuring and improving C and C++ performance.
Bartłomiej Filipek started this list in 2016 and still maintains it. He writes about modern C++ and software development on the C++ Stories blog and in its newsletter. GitHub profile · C++ Stories
Contents
Getting Started
- Measure your program before changing it. See the C++ Core Guidelines on performance.
- Watch Chandler Carruth show how the compiler and CPU affect small benchmarks in Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!.
- For an introduction to caches, watch Scott Meyers' CPU Caches and Why You Care. For more on how hardware affects algorithm design, read Algorithms for Modern Hardware.
- Find the slow part with a profiler. If you measure it separately, use the same kind of data the program normally handles. Save the inputs, build flags, and command so you can run the test again after a change. See Google Benchmark and How to microbenchmark.
- To practice finding bottlenecks, try the Performance Ninja exercises.
Talks
Talks are grouped by conference year. When applying techniques from older talks, check their assumptions about hardware and compiler behavior.
2026
- C++Now: Matt Godbolt, Benchmarking: It's About Time - What clocks and timers actually measure in a benchmark.
- CppCon: Aryan Naraghi, From 20 Nanoseconds to One: Optimizing Bishop, Rook, and Queen Move Generation in a Chess Engine
- CppCon: Andrew Drakeford, Same Bits Without Losing MIPS: Reproducible Numerics at Full Hardware Speed
2025
- CppCon: Vittorio Romeo, More Speed & Simplicity: Practical Data-Oriented Design in C++ - Designing around data layout and access patterns.
- CppCon: Grischa Hauser, CTRACK: C++ Performance Tracking and Bottleneck Discovery
- CppCon: Hamish Morrison, Building a High-Performance Binary Serialization Format with In-Place Modification
2024
- CppCon: David Gross, When Nanoseconds Matter: Ultrafast Trading Systems in C++ - Data structures, communication, and design choices for low latency.
- CppCon: Olaf Krzikalla, Vectorizing Computational Fluid Dynamics (CFD) Code in C++ Using std::simd
- CppCon: Michael A. Maniscalco, Work Contracts: Rethinking Task-Based Concurrency and Parallelism for Low-Latency C++
2023
- CppCon: Oleksandr Bacherikov, Is C++23 std::mdspan a Zero-overhead Abstraction?
- CppCon: Shachar Shemesh, Optimizing Away C++ Virtual Functions May Be Pointless
- CppCon: Ollivier Roberge, Can C++ Data-Oriented Design Be Improved?
2022
- CppCon: Sergey Slotin, Optimizing Binary Search
- CppCon: Parsa Amini, Understanding Allocator Impact on Runtime Performance in C++
- CppCon: Andrew Drakeford, Fast C++ by Using SIMD Types with Generic Lambdas and Filters
2021
- CppCon: Fedor Pikus, Branchless Programming in C++ - When removing branches helps, and when prediction or extra work changes the result.
- CppCon: Joel Falcou and Denis Yaroshevskiy, SIMD in C++20: EVE of a New Era - Vectorized C++ with the EVE library.
- CppCon: Michael Wong, Paul E. McKenney, and Maged Michael, The Upcoming Concurrency TS Version 2 for Low-Latency and Lockless Synchronization - The proposal as it stood in 2021.
2020
- CppCon: Emery Berger, Performance Matters
- CppCon: Bob Steagall, Adventures in SIMD-Thinking (part 1, part 2)
- CppCon: JF Bastien, Just-in-Time Compilation
2019
- CppCon: Matt Kulukundis, Abseil's Open Source Hashtables: 2 Years In - A follow-up to the 2017 hash table talk.
- CppCon: Samy Al Bahra and Paul Khuong, Abusing Your Memory Model for Fun and Profit
- CppCon: Matt Godbolt, Path Tracing Three Ways: A Study of C++ Style
2018
- CppCon: Fedor Pikus, Design for Performance
- CppCon: Alan Talbot, Moving Faster: Everyday Efficiency in Modern C++
- C++Now: Malte Skarupke, You Can Do Better than std::unordered_map: New Improvements to Hash Table Performance
2017
- CppCon: Chandler Carruth, Going Nowhere Faster
- CppCon: Matt Kulukundis, Designing a Fast, Efficient, Cache-Friendly Hash Table, Step by Step
- CppCon: Fedor Pikus, C++ Atomics, from Basic to Advanced: What Do They Really Do?
2016
- ACCU: Andrei Alexandrescu, Fastware - Making performance an explicit engineering concern.
- C++Now: Timur Doumler, C++ Performance in Practice: Align, Vectorise, Cache, Jump! (slides) - Connecting C++ code to hardware execution.
- C++Now: David Stone, Exceptional Performance - Exploring the performance implications of exceptions.
- C++Now: Jason Turner, Practical Performance Practices - Examples shown alongside the generated code.
- CppCon: Timur Doumler, Want fast C++? Know your hardware! - Hardware details that affect software design.
- CppCon: Jason Turner, Practical Performance Practices
- CppCon: Chandler Carruth, High Performance Code 201: Hybrid Data Structures - Combining data structures to fit access patterns.
- CppCon: Paul McKenney, Beyond the Issaquah Challenge: High-Performance Scalable Complex Updates - Scalable concurrent updates.
- CppCon: D. Dechev and D. Zhang, High Performance C++ Concurrent Transactional Data Structures
- CppCon: Matthew Bentley, Colonies, performance and why you should care - Container design and allocation tradeoffs.
- CppCon: Christiaan Pretorius, Cache Optimized Hash Tables - Hash-table layout and cache behavior.
- CppCon: Tim Haines, Improving Performance Through Compiler Switches - How build flags affect performance. Results can vary with the compiler version.
2015
- code::dive: Andrei Alexandrescu, Writing Fast Code I and Writing Fast Code II (archived slides) - A two-part workshop on reasoning about fast code.
- CppCon: Chandler Carruth, Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My! - Constructing useful benchmarks and interpreting generated code.
- CppCon: Bryce Adelstein-Lelbach, Benchmarking C++ Code - Microbenchmarking.
- Meeting C++: Chandler Carruth, Understanding Compiler Optimization - Understanding what optimizers can and cannot infer.
2014
- code::dive: Scott Meyers, CPU Caches and Why You Care (slides) - A practical introduction to cache-aware programming.
- CppCon: Andrei Alexandrescu, Optimization Tips - Mo' Hustle Mo' Problems - Measurement and concrete optimization experiments.
- CppCon: Mike Acton, Data-Oriented Design and C++ - Organizing data around the transformations a program performs.
- CppCon: Chandler Carruth, Efficiency with Algorithms, Performance with Data Structures - Why algorithmic complexity alone is not enough.
2013
- Going Native: Andrei Alexandrescu, Writing Quick Code in C++, Quickly
- Going Native: Stephan T. Lavavej, rand() Considered Harmful - Random-number generation, quality, and implementation costs.
- Going Native: Sean Parent, C++ Seasoning - Algorithms and design choices that improve everyday C++ code.
Articles
Dated articles are listed newest first within each topic, by publication, update, or edition year. Undated articles follow.
Measurement and profiling
- How to microbenchmark, Chris Kennelly (2023, updated 2025) - Designing a benchmark around a production workload and interpreting its results.
- Strobelight: A profiling service built on open source technology, Meta engineering (2025) - Production profiling, symbolization, and feedback-directed optimization at fleet scale.
- Memory Profiling Part 1: Introduction, Denis Bakhvalov (2024) - A series on footprint, memory accesses, and hardware-level bottlenecks.
- Micro benchmarking libraries for C++, Bartłomiej Filipek (2016) - Historical comparison of C++ microbenchmarking libraries. Check maintenance status before adopting a library.
- gprof, Valgrind and gperftools: an evaluation of CPU profiling tools on Linux, Gernot Klingler (2015, archived) - Historical comparison of profiler overhead and functionality.
- How to start with Software Optimization, Bartłomiej Filipek (2014) - Establishing a baseline and profiling a particle system.
- C++ timing strategies compared in Windows (2011) - Timing experiments on older versions of Windows and hardware.
- C++ Core Guidelines: Performance - Principles for measuring and improving performance without sacrificing correctness.
- C++ Best Practices: Considering Performance - Runtime and build performance guidance. Some examples use older tools.
- ETW Central, Bruce Dawson - Windows tracing examples and investigations.
CPU architecture, caches, and data layout
- Data Oriented Design by example, Nikita Black (2017) - Comparing object-oriented and data-oriented layouts in a simulation.
- Hash Functions all the way down and More Hash Function Tests, Aras Pranckevičius (2016) - Workload-dependent hash-function experiments.
- C++ benchmark: std::vector vs std::list vs std::deque, Baptiste Wicht (2012) - Historical measurements of three containers across different access patterns.
- Why GNU grep is fast, Mike Haertel (2010) - Algorithm selection and reducing work in a production utility.
- Why do CPUs have multiple cache levels?, Fabian Giesen - Cache hierarchy, latency, and bandwidth.
- Taking advantage of cache coherence in your programs - Memory access experiments relevant to spatial locality and hardware cache coherence.
- Gallery of Processor Cache Effects, Igor Ostrovsky - C# examples illustrating hardware effects that also matter in C and C++.
- How We Beat C++ STL Binary Search, Realm (archived) - Historical search case study. Access depends on archive availability.
- Container Study, Josh Barczak - Comparing container behavior under particular access patterns.
- Associative-container performance tests, GCC libstdc++ - Older benchmarks comparing policy-based data structures.
- The Performance API (PAPI) - Portable API for hardware performance counters. Available events vary by platform.
- Roofline Performance Model, NERSC - Relating arithmetic intensity to compute and memory-bandwidth limits.
- Intel 64 and IA-32 Architectures Optimization Reference Manuals - Official optimization manuals for Intel microarchitectures.
- That's Not Normal: the Performance of Odd Floats, Bruce Dawson - Subnormal floating-point values and hardware-dependent slow paths.
Modern C++ and allocation
- C++26: Standard Library Hardening Experiments, Bartłomiej Filipek (2026) - Measured costs of runtime checks under specific library settings and C++ versions.
- Details of std::mdspan from C++23, Bartłomiej Filipek (2025) - Non-owning multidimensional views, extents, and layout policies, with C++26 additions.
- C++ String Conversion: Exploring std::from_chars in C++17 to C++26, Bartłomiej Filipek (updated 2024) - Non-allocating numeric conversion, benchmarks, and later standard changes.
- Three Benchmarks of C++20 Ranges vs Standard Algorithms, Bartłomiej Filipek (2022) - Comparing composition, temporary objects, and build time on the tested implementations.
- Number Parsing at a Gigabyte per Second, Daniel Lemire (2021) - How integer multiplication and precomputed tables speed up correctly rounded decimal-to-floating-point conversion.
- Polymorphic Allocators, std::vector Growth and Hacking, Bartłomiej Filipek (2020) - C++17 memory resources, allocation tracing, and container growth.
- Three Optimization Tips for C++, Andrei Alexandrescu (2013) - Examples of reducing the work an algorithm does.
Concurrency and low latency
- Thread Count Scaling Part 1: Introduction, Denis Bakhvalov (2024) - A series investigating scaling, SMT, and workload bottlenecks.
- Optimizing a ring buffer for throughput, Erik Rigtorp (2021) - A measured single-producer/single-consumer queue case study with cache-coherence analysis.
- Correctly implementing a spinlock in C++, Erik Rigtorp (2020) - Memory ordering and contention costs in a C++ spinlock implementation.
- Guide into OpenMP: Easy multithreading programming for C++ - An introduction with examples written for older OpenMP versions.
Compilers and vectorization
- Loop Optimizations: taking matters into your hands, Ivica Bogosavljević (2021) - Worked examples of how function calls and pointer aliasing limit the optimizations a compiler can apply to a loop.
- Clang: Profile Guided Optimization - How to collect profiles through instrumentation or sampling. Use inputs that reflect how the program runs in practice.
- ThinLTO, Clang - Cross-module optimization with parallel and incremental compilation.
- Auto-Vectorization in LLVM - Loop and SLP vectorization, optimization remarks, and reasons vectorization can fail.
GPU and heterogeneous computing
- Kernel Fusion in NVIDIA CUDA: Optimizing Memory Traffic and Launch Overhead, Daniel Rodriguez (2026) - CUDA C++ code and profiler traces show how fusing two kernels eliminates an intermediate array in
sum(abs(x)). - oneAPI GPU Optimization Guide, Intel (2025 edition) - SYCL and OpenMP offload, work-group sizing, registers, and host/device coordination.
- CUDA C++ Best Practices Guide, NVIDIA - Profiling, memory transfers, memory access, and kernel optimization.
Sites/Blogs
- Agner's CPU blog - Processor architecture and optimization discussions.
- Agner Fog's Software optimization resources - Manuals, instruction tables, and microarchitecture analysis.
- C++ Stories - Modern C++ examples and performance experiments.
- Daniel Lemire's blog - SIMD, parsing, algorithms, and measured performance experiments.
- The Every Computer Performance Blog - Capacity planning, modeling, and interpreting results.
- Random ASCII - Windows profiling, correctness, and performance investigations.
- The ryg blog - Low-level programming, graphics, and hardware explanations.
- The Supercomputing Blog - Historical optimization and parallel-programming articles.
- Wojciech Muła's articles - SIMD, parsing, and performance experiments.
Tools
Use a sampling profiler to identify CPU hotspots and an allocation tracer to find where memory is allocated. Check platform support, availability, and licensing in the tool's documentation.
CPU profiling and tracing
- AMD uProf - CPU profiling and system analysis, including AMD hardware counters.
- Compiler Explorer - Optimized assembly inspection and compiler comparison. Use workload profiling to measure runtime impact.
- gperftools - CPU and heap profiling utilities, plus TCMalloc.
- Intel VTune Profiler - CPU and GPU performance analysis. Hardware features vary by target.
- Linux perf - Sampling, hardware counters, call graphs, and annotation on Linux.
- TAU Performance System - Profiling and tracing parallel applications.
- Tracy - Instrumentation and sampling, CPU/GPU timelines, allocations, and lock analysis.
- uops.info - Measured x86 instruction latency, throughput, and port usage across microarchitectures.
- Very Sleepy - A sampling CPU profiler for Windows.
- Visual Studio CPU profiling - Native-code CPU usage analysis in Visual Studio.
- Windows Performance Toolkit - Record and analyze ETW traces with Windows Performance Recorder and Analyzer.
Memory and allocation analysis
- Deleaker - Commercial Windows allocation and resource-leak analysis.
- heaptrack - Linux heap allocation tracing and analysis of allocation hotspots.
- Valgrind - Instrumentation suite including Cachegrind, Callgrind, and Massif. Simulation and instrumentation can add substantial overhead.
- WonderLeak - Windows heap and handle allocation profiling.
GPU and parallel analysis
- Intel Advisor - Vectorization, threading, and offload analysis. Check toolchain support.
- NVIDIA Nsight Systems - CPU/GPU timelines and system-level analysis.
- NVIDIA Nsight Compute - CUDA kernel profiling and hardware metrics.
- Qualcomm Snapdragon Profiler - Profiling for supported Snapdragon devices and operating systems.
Historical and specialized tools
- AMD CodeXL - AMD archived the source in April 2020. For CPU profiling, see AMD uProf. For GPU frame profiling, see Radeon GPU Profiler.
- AQTime documentation - Legacy native-code profiler. SmartBear discontinued support and announced the end of access after June 30, 2026.
- GlowCode - Windows profiling and leak detection. Check compiler and OS compatibility.
- OProfile - Historical Linux system profiler. Automated requests may encounter a bot challenge.
- Oracle Developer Studio - Specialized tooling including Performance Analyzer for supported Oracle platforms.
- Proffy source - Historical Windows native-code profiler.
Libraries
Benchmarking
If you're timing a function that processes a buffer, create the buffer before you start the timer. Check that the compiler hasn't optimized away the work you want to measure. Repeat the test, note whether the data is already in the cache, and compare the results with what you see in the application.
- Google Benchmark - Microbenchmark framework with repetitions, fixtures, counters, and optimization barriers.
- Celero - Benchmark authoring with baseline comparisons.
- Hayai (archived introduction) - Historical C++ microbenchmarking framework.
- Nonius - Historical benchmarking framework with statistical analysis. The source repository remains available.
Allocation, SIMD, and parallelism
- fast_float - Numeric parsing with a
from_chars-style interface and documented accuracy guarantees. - Highway - Portable SIMD intrinsics with multiple architectures and runtime target dispatch.
- mimalloc - General-purpose allocator. Compare throughput and memory use in your application and check what it takes to adopt.
- oneTBB - Task-based parallelism, concurrent containers, and scalable allocation facilities.
- simdjson - SIMD JSON parser that selects an implementation at runtime. The project documents how it benchmarks parsing.
- UltrafastSecp256k1 - High-performance
secp256k1engine with CPU, CUDA, OpenCL, embedded, and WebAssembly targets, plus broad benchmarking and validation tooling.
Books
- Algorithms for Modern Hardware, Sergey Slotin - Free online book on CPU architecture, caches, SIMD, and algorithm engineering. Some planned chapters are incomplete.
- Performance Analysis and Tuning on Modern CPUs, Denis Bakhvalov (second edition, 2024) - Free book and examples on hardware-aware measurement and tuning.
- Optimizing software in C++, Agner Fog - Free optimization manual, maintained alongside the author's processor-specific references.
- Optimizing C++, Wikibooks - Community reference. Some chapters are more complete or up to date than others.
- Systems Performance: Enterprise and the Cloud, Brendan Gregg (second edition, 2020) - System-level methodology and Linux observability.
- C++ Concurrency in Action, second edition, Anthony Williams - C++ concurrency and the memory model.
- Optimized C++: Proven Techniques for Heightened Performance, Kurt Guntheroth - Practical C++ optimization and measurement.
- Every Computer Performance Book, Bob Wescott - Performance analysis, capacity planning, and presenting results.
- Power and Performance: Software Analysis and Optimization, Jim Kukunas - System-level analysis with a power/performance focus.
- Video Game Optimization, Eric Preisz - Historical game-development optimization practices.
- The Software Optimization Cookbook: High Performance Recipes for IA-32 Platforms, second edition - Older x86 reference. Check whether its advice applies to your CPU and compiler.
- C++ Optimization Bibliography, Kurt Guntheroth (2016) - Further historical reading.
About
The collection was inspired by the awesome lists.
Submit additions and corrections through a pull request. For new resources, briefly explain what they cover and how they help readers working on C or C++ performance. Contribution guidelines
License
This work is licensed under a Creative Commons Attribution 4.0 International License.
Jelajahi proyek terkait
Memuat…