English | 简体中文 | GitHub Pages | Discussions
Learn measurable C++20 performance engineering through runnable examples, benchmarks, and a VitePress-powered learning site.
This project is a practical guide to common C++ performance topics that are easy to talk about but harder to validate:
- modern CMake and preset-driven builds
- memory and cache layout decisions
- modern C++ performance patterns
- SIMD and vectorization
- concurrency and lock-free basics
- profiling and benchmark-driven reasoning
Every major topic is meant to be readable, buildable, and measurable.
| Area | What it covers |
|---|---|
examples/01-cmake-modern/ |
modern CMake structure and anti-patterns |
examples/02-memory-cache/ |
AOS vs SOA, false sharing, alignment, prefetch |
examples/03-modern-cpp/ |
constexpr, move semantics, reserve, ranges |
examples/04-simd-vectorization/ |
auto-vectorization, intrinsics, SIMD wrappers |
examples/05-concurrency/ |
atomics, lock-free queue, OpenMP |
docs/ |
bilingual learning path, profiling guide, troubleshooting, reference |
openspec/ |
spec-driven development workflow and change history |
git clone https://github.com/LessUp/cpp-high-performance-guide.git
cd cpp-high-performance-guide
cmake --preset=release
cmake --build build/releaseRun one benchmark:
./build/release/examples/02-memory-cache/aos_soa_benchcmake --preset=debug && cmake --build build/debug && ctest --preset=debug
cmake --preset=release && cmake --build build/release && ctest --preset=release
cmake --preset=asan && cmake --build build/asan && ctest --preset=asan
cmake --preset=tsan && cmake --build build/tsan && ctest --preset=tsan
cmake --preset=ubsan && cmake --build build/ubsan && ctest --preset=ubsan- Docs site: https://lessup.github.io/cpp-high-performance-guide/
- Quick start:
docs/en/getting-started/quickstart.md - Learning path:
docs/en/guides/learning-path.md - Profiling guide:
docs/en/guides/profiling-guide.md - Chinese entry:
README.zh-CN.mdanddocs/zh/
This repository uses OpenSpec for non-trivial changes.
- Read the affected capability specs in
openspec/specs/. - Create or update a change under
openspec/changes/<change-id>/. - Implement tasks in dependency order.
- Run preset-driven validation.
- Use
/reviewbefore merge for non-trivial work. - Archive completed changes.
The repository also keeps AI tool guidance in:
AGENTS.mdCLAUDE.md.github/copilot-instructions.md
- Language: C++20
- Build: CMake 3.22+, Ninja
- Testing: Google Test, RapidCheck
- Benchmarking: Google Benchmark
- Docs: VitePress + GitHub Pages
- Profiling: perf, FlameGraph, Valgrind, VTune
See CONTRIBUTING.md for the contributor workflow, hooks setup, and OpenSpec process.