Skip to content

Commit 4f77881

Browse files
author
shijiashuai
committed
docs: 重构文档信息架构,分离仓库入口与文档首页
- 新增 DOCS.md 作为 HonKit/GitBook 文档首页,集中承载学习路径与核心文档入口 - 将 README.md/README.zh-CN.md 收敛为仓库入口,仅保留项目概览与快速开始 - 重构 SUMMARY.md 目录结构,按语言和模块分组,提升导航清晰度 - 更新 .gitbook.yaml 和 book.json 的 readme 配置指向 DOCS.md - 调整 Pages workflow 触发分支为 master,main 并补充 DOCS.md 与 changelog 路径 - 同步更新中英文 gitbook-sync.md 说明,明确默认分支和首页变更 - 新增 changelog 记录本次架构调整的背景、变更细节与验证结果
1 parent c36e940 commit 4f77881

10 files changed

Lines changed: 151 additions & 316 deletions

File tree

.gitbook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
root: ./
22
structure:
3-
readme: README.md
3+
readme: DOCS.md
44
summary: SUMMARY.md

.github/workflows/pages.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ name: Deploy Docs
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [master, main]
66
paths:
77
- "docs/**"
88
- "examples/*/README.md"
99
- "README.md"
1010
- "README.zh-CN.md"
11+
- "DOCS.md"
1112
- "SUMMARY.md"
1213
- "CONTRIBUTING.md"
1314
- "CONTRIBUTING.zh.md"
@@ -16,6 +17,7 @@ on:
1617
- "package.json"
1718
- "package-lock.json"
1819
- ".github/workflows/pages.yml"
20+
- "changelog/**"
1921
workflow_dispatch:
2022

2123
permissions:
@@ -34,15 +36,15 @@ jobs:
3436
- uses: actions/checkout@v4
3537
with:
3638
sparse-checkout: |
37-
docs/en
38-
docs/zh
39+
docs
3940
examples/01-cmake-modern/README.md
4041
examples/02-memory-cache/README.md
4142
examples/03-modern-cpp/README.md
4243
examples/04-simd-vectorization/README.md
4344
examples/05-concurrency/README.md
4445
README.md
4546
README.zh-CN.md
47+
DOCS.md
4648
SUMMARY.md
4749
CONTRIBUTING.md
4850
CONTRIBUTING.zh.md

DOCS.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Documentation Home
2+
3+
This site is the documentation entry for the C++ High Performance Computing Optimization Guide. Start here when you want a reading path, a language-specific guide, or direct access to the example modules.
4+
5+
## Project Positioning
6+
7+
- Learn modern C++ performance engineering through runnable examples instead of isolated notes.
8+
- Cover the path from build system fundamentals to memory and cache behavior, SIMD, concurrency, benchmarking, and profiling.
9+
- Keep the repository README focused on repository setup while this page focuses on documentation entry points and reading order.
10+
11+
## Who This Is For
12+
13+
- C++ engineers who want a structured path into performance optimization.
14+
- Students and self-learners comparing optimization techniques with executable examples.
15+
- Maintainers who need profiling, benchmarking, and contribution references.
16+
17+
## Start Here
18+
19+
- English readers: [Learning Path](docs/en/learning-path.md)
20+
- 中文读者: [学习路径](docs/zh/learning-path.md)
21+
- Need tooling first: [Profiling Guide](docs/en/profiling-guide.md) and [性能分析指南](docs/zh/profiling-guide.md)
22+
- Need site sync details: [GitBook Sync Guide](docs/en/gitbook-sync.md) and [GitBook 接入指南](docs/zh/gitbook-sync.md)
23+
24+
## Recommended Reading Paths
25+
26+
| Goal | Recommended path |
27+
| --- | --- |
28+
| First visit | Learning Path -> example modules -> profiling guide |
29+
| Benchmark or hotspot analysis | Profiling Guide -> memory and cache module -> SIMD module |
30+
| Add or extend a module | Contributing guide -> relevant module README -> learning path |
31+
32+
## Core Documents
33+
34+
| Topic | English | 中文 |
35+
| --- | --- | --- |
36+
| Learning path | [Learning Path](docs/en/learning-path.md) | [学习路径](docs/zh/learning-path.md) |
37+
| Profiling | [Profiling Guide](docs/en/profiling-guide.md) | [性能分析指南](docs/zh/profiling-guide.md) |
38+
| Site sync | [GitBook Sync Guide](docs/en/gitbook-sync.md) | [GitBook 接入指南](docs/zh/gitbook-sync.md) |
39+
| Contribution | [Contributing](CONTRIBUTING.md) | [参与贡献](CONTRIBUTING.zh.md) |
40+
41+
## Example Modules
42+
43+
- [01 - Modern CMake](examples/01-cmake-modern/README.md)
44+
- [02 - Memory & Cache Optimization](examples/02-memory-cache/README.md)
45+
- [03 - Modern C++ Features](examples/03-modern-cpp/README.md)
46+
- [04 - SIMD Vectorization](examples/04-simd-vectorization/README.md)
47+
- [05 - Concurrency](examples/05-concurrency/README.md)

README.md

Lines changed: 16 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,33 @@
11
# C++ High Performance Computing Optimization Guide
22

3-
English | [简体中文](README.zh-CN.md) | [GitBook Sync Guide](docs/en/gitbook-sync.md)
3+
English | [简体中文](README.zh-CN.md) | [Documentation Home](https://lessup.github.io/cpp-high-performance-guide/)
44

5-
[![Build](https://img.shields.io/github/actions/workflow/status/LessUp/cpp-high-performance-guide/build.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=Build)](https://github.com/LessUp/cpp-high-performance-guide/actions/workflows/build.yml)
6-
[![Benchmarks](https://img.shields.io/github/actions/workflow/status/LessUp/cpp-high-performance-guide/benchmark.yml?branch=main&style=for-the-badge&logo=speedtest&logoColor=white&label=Benchmarks)](https://github.com/LessUp/cpp-high-performance-guide/actions/workflows/benchmark.yml)
7-
[![Sanitizers](https://img.shields.io/github/actions/workflow/status/LessUp/cpp-high-performance-guide/sanitizers.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=Sanitizers)](https://github.com/LessUp/cpp-high-performance-guide/actions/workflows/sanitizers.yml)
8-
[![Docs](https://img.shields.io/github/actions/workflow/status/LessUp/cpp-high-performance-guide/pages.yml?branch=main&style=for-the-badge&logo=githubpages&logoColor=white&label=Docs)](https://lessup.github.io/cpp-high-performance-guide/)
5+
A modern C++20 example collection for learning performance engineering across build systems, memory and cache behavior, SIMD, concurrency, benchmarking, and profiling.
96

10-
A comprehensive collection of high-performance computing optimization examples and best practices for modern C++20.
7+
## Repository Overview
118

12-
## Features
13-
14-
- **Modern CMake Build System** - Target-based CMake with presets, FetchContent dependencies
15-
- **Memory & Cache Optimization** - AOS vs SOA, false sharing, alignment, prefetching
16-
- **Modern C++ Features** - constexpr, move semantics, vector reserve, C++20 ranges
17-
- **SIMD Vectorization** - Auto-vectorization, SSE/AVX2/AVX-512 intrinsics, wrapper library
18-
- **Concurrency** - Atomic operations, lock-free queues, OpenMP integration
19-
- **Benchmarking Framework** - Google Benchmark integration, FlameGraph generation
9+
- `examples/`: five themed modules covering modern CMake, memory and cache optimization, modern C++ features, SIMD, and concurrency.
10+
- `benchmarks/` and `tools/`: benchmark runners, FlameGraph helpers, and analysis scripts.
11+
- `docs/`: bilingual learning path, profiling guide, and HonKit or GitBook synchronization notes.
12+
- `tests/`: unit, integration, and property-style checks for the example collection.
2013

2114
## Quick Start
2215

23-
### Prerequisites
24-
25-
- C++20 compatible compiler (GCC 11+, Clang 14+)
26-
- CMake 3.20+
27-
- Ninja (recommended) or Make
28-
29-
### Build
30-
3116
```bash
32-
# Clone the repository
33-
git clone https://github.com/LessUp/cpp-high-performance-guide.git
34-
cd cpp-high-performance-guide
35-
36-
# Configure and build (Release mode)
3717
cmake --preset=release
3818
cmake --build build/release
39-
40-
# Run all benchmarks
41-
cd build/release && ctest --output-on-failure
42-
```
43-
44-
### Available Presets
45-
46-
| Preset | Description |
47-
|--------|-------------|
48-
| `debug` | Debug build with symbols |
49-
| `release` | Optimized release build (-O3, -march=native) |
50-
| `asan` | AddressSanitizer enabled |
51-
| `tsan` | ThreadSanitizer enabled |
52-
53-
```bash
54-
# Build with sanitizers
55-
cmake --preset=asan
56-
cmake --build build/asan
57-
```
58-
59-
## Project Structure
60-
61-
```
62-
cpp-high-performance-guide/
63-
├── cmake/ # CMake modules
64-
│ ├── CompilerOptions.cmake # Compiler flags management
65-
│ ├── Dependencies.cmake # FetchContent dependencies
66-
│ ├── Sanitizers.cmake # Sanitizer configuration
67-
│ └── ExampleTemplate.cmake # Example module template
68-
├── examples/
69-
│ ├── 01-cmake-modern/ # CMake best practices vs anti-patterns
70-
│ ├── 02-memory-cache/ # Memory and cache optimization
71-
│ ├── 03-modern-cpp/ # Modern C++ features
72-
│ ├── 04-simd-vectorization/ # SIMD and vectorization
73-
│ └── 05-concurrency/ # Concurrent programming
74-
├── benchmarks/ # Benchmark utilities
75-
├── tests/ # Unit and property tests
76-
├── tools/ # Analysis and profiling tools
77-
└── docs/ # Documentation
78-
```
79-
80-
## Example Modules
81-
82-
### 01 - Modern CMake
83-
Learn CMake best practices through anti-pattern vs best-practice comparisons.
84-
- Target-based vs directory-based commands
85-
- FetchContent dependency management
86-
- Compiler options management
87-
88-
### 02 - Memory & Cache Optimization
89-
Master cache-friendly programming techniques.
90-
- **AOS vs SOA**: Data layout impact on performance
91-
- **False Sharing**: Multi-threaded cache line contention
92-
- **Alignment**: SIMD-friendly memory alignment
93-
- **Prefetching**: Manual prefetch hints
94-
95-
### 03 - Modern C++ Features
96-
Leverage modern C++ for performance.
97-
- **constexpr/consteval**: Compile-time computation
98-
- **Move Semantics**: Avoid unnecessary copies
99-
- **Vector Reserve**: Reduce allocations
100-
- **C++20 Ranges**: Modern iteration patterns
101-
102-
### 04 - SIMD Vectorization
103-
Maximize CPU throughput with SIMD.
104-
- **Auto-vectorization**: Compiler-friendly patterns
105-
- **Intrinsics**: SSE, AVX2, AVX-512 examples
106-
- **SIMD Wrapper**: Readable SIMD abstractions
107-
108-
### 05 - Concurrency
109-
Write efficient multi-threaded code.
110-
- **Atomic Operations**: Memory ordering explained
111-
- **Lock-Free Queue**: SPSC queue implementation
112-
- **OpenMP**: Simple parallelization patterns
113-
114-
## Running Benchmarks
115-
116-
```bash
117-
# Run all benchmarks
118-
cd build/release
119-
ctest --output-on-failure
120-
121-
# Run specific benchmark
122-
./examples/02-memory-cache/bench/aos_soa_bench
123-
124-
# Export benchmark results to JSON
125-
./examples/02-memory-cache/bench/aos_soa_bench --benchmark_format=json > results.json
126-
```
127-
128-
## Profiling
129-
130-
Generate FlameGraph visualizations:
131-
132-
```bash
133-
# Record performance data
134-
./tools/flamegraph/generate_flamegraph.sh ./build/release/examples/02-memory-cache/bench/aos_soa_bench
135-
136-
# View the generated SVG
137-
firefox flamegraph.svg
19+
ctest --preset=release
13820
```
13921

14022
## Documentation
14123

142-
- [Learning Path](docs/en/learning-path.md) - Recommended order for studying examples
143-
- [Profiling Guide](docs/en/profiling-guide.md) - How to profile and analyze performance
144-
- [GitBook Sync Guide](docs/en/gitbook-sync.md) - Connect this repository to GitBook for online reading
145-
146-
## Contributing
147-
148-
1. Fork the repository
149-
2. Create a feature branch
150-
3. Ensure all tests pass with sanitizers
151-
4. Submit a pull request
152-
153-
## License
154-
155-
MIT License - see [LICENSE](LICENSE) for details.
24+
- Docs site: https://lessup.github.io/cpp-high-performance-guide/
25+
- Learning path: `docs/en/learning-path.md` and `docs/zh/learning-path.md`
26+
- Profiling guide: `docs/en/profiling-guide.md` and `docs/zh/profiling-guide.md`
27+
- HonKit or GitBook sync notes: `docs/en/gitbook-sync.md` and `docs/zh/gitbook-sync.md`
15628

157-
## Acknowledgments
29+
## Development
15830

159-
- [Google Benchmark](https://github.com/google/benchmark)
160-
- [Google Test](https://github.com/google/googletest)
161-
- [RapidCheck](https://github.com/emil-e/rapidcheck)
162-
- [FlameGraph](https://github.com/brendangregg/FlameGraph)
31+
- Contribution guide: `CONTRIBUTING.md` and `CONTRIBUTING.zh.md`
32+
- Changelog: `changelog/`
33+
- License: `LICENSE`

0 commit comments

Comments
 (0)