Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LessUp/cpp-high-performance-guide

Repository files navigation

C++ High Performance Guide

Stars CI License

English | 简体中文 | GitHub Pages | Discussions

Learn measurable C++20 performance engineering through runnable examples, benchmarks, and a VitePress-powered learning site.

Why this repository exists

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.

What you can explore

Area What it covers
examples/01-cmake-modern/ modern CMake structure and best practices
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 Pages whitepaper covering academy, architecture, playbook, reference, research

Quick start

git clone https://github.com/LessUp/cpp-high-performance-guide.git
cd cpp-high-performance-guide
cmake --preset=release
cmake --build build/release

Run one benchmark:

./build/release/examples/02-memory-cache/aos_soa_bench

Need the redesigned docs route after the quick start? Start with docs/en/playbook/index.md, then continue to docs/en/guides/validation.md for sanitizer-specific guidance.

Validation commands

cmake --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

Documentation entry points

Tech stack

  • Language: C++20
  • Build: CMake 3.22+, Ninja
  • Testing: Google Test, RapidCheck
  • Benchmarking: Google Benchmark
  • Docs: VitePress + GitHub Pages
  • Profiling: perf, FlameGraph, Valgrind, VTune

Contributing

See CONTRIBUTING.md for the contributor workflow and hooks setup.

About

High-performance C++ optimization guide with lock-free data structures, SIMD, and memory optimization examples | 高性能 C++ 优化指南,包含无锁数据结构、SIMD 和内存优化示例

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /