Skip to content

Commit bd5f210

Browse files
committed
docs: 大范围整改——以深度专题为核心重建文档站
结构重建: - 删除无代码支撑的板块(algorithms/exercises/academy/architecture/research/playbook) - 合并入门三页为单页 getting-started.md - 合并 3 个 API 页为单页 reference/api.md - 合并 FAQ 到 troubleshooting.md - 合并 guides 为 profiling.md + optimization-playbook.md 内容重写: - 重写 3 篇深度专题(memory-layout/simd/lock-free),引用仓库真实代码 - 新增 2 篇深度专题(cmake-build-system/modern-cpp-perf) - 重写性能分析实战指南,所有命令使用仓库真实路径 - 重写优化决策手册,合并决策树与最佳实践 - 重写首页,突出'可验证'定位 基础设施精简: - 删除 5 个自定义 Vue 组件(Citation/ComplexityBadge/DiagramCanvas/SectionIndex/BaseAwareLink) - 移除 mermaid/llms 插件依赖 - 合并 4 个 CSS token 文件为单文件 style.css - 更新测试匹配新结构 - 更新 examples README 中的文档链接
1 parent d1fc1f6 commit bd5f210

52 files changed

Lines changed: 3183 additions & 10167 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
| `examples/03-modern-cpp/` | constexpr、移动语义、reserve、ranges |
4343
| `examples/04-simd-vectorization/` | 自动向量化、intrinsics、SIMD 封装 |
4444
| `examples/05-concurrency/` | 原子操作、无锁队列、OpenMP |
45-
| `docs/` | VitePress 文档站,覆盖学院 / 架构 / 实践手册 / 参考 / 研究 |
45+
| `docs/` | VitePress 文档站,覆盖深度专题 / 实战指南 / API 参考 |
4646

4747
## 快速开始
4848

@@ -74,8 +74,8 @@ cmake --preset=ubsan && cmake --build build/ubsan && ctest --preset=ubsan
7474
## 文档入口
7575

7676
- **文档站:** <https://lessup.github.io/cpp-high-performance-guide/>
77-
- **实践手册** [`docs/zh/playbook/index.md`](docs/zh/playbook/index.md)
78-
- **参考:** [`docs/zh/reference/index.md`](docs/zh/reference/index.md)
77+
- **深度专题** [`docs/zh/deep-dives/`](docs/zh/deep-dives/)
78+
- **API 参考:** [`docs/zh/reference/api.md`](docs/zh/reference/api.md)
7979

8080
## 技术栈
8181

docs/.vitepress/config.ts

Lines changed: 27 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { defineConfig } from 'vitepress'
2-
import { withMermaid } from 'vitepress-plugin-mermaid'
3-
import llmstxt from 'vitepress-plugin-llms'
42

53
const rawBase = process.env.VITEPRESS_BASE
64
const base = rawBase
@@ -10,93 +8,23 @@ const base = rawBase
108
: '/'
119

1210
const siteTitle = 'C++ 高性能指南'
13-
const siteDescription = '可运行的 C++ 性能工程文档,覆盖入门、指南、深度专题、算法、练习与参考。'
14-
const siteUrl = 'https://lessup.github.io'
15-
const canonicalBase = '/cpp-high-performance-guide/'
11+
const siteDescription = '可验证的现代 C++20 性能工程:内存布局、SIMD、无锁并发、构建系统,全部附带可运行代码与基准测试。'
1612
const currentYear = new Date().getFullYear()
1713

18-
function assetPath(path: string): string {
19-
const normalizedPath = path.replace(/^\/+/, '')
20-
return `${base}${normalizedPath}`
21-
}
22-
23-
function canonicalAssetUrl(path: string): string {
24-
const normalizedPath = path.replace(/^\/+/, '')
25-
return new URL(`${canonicalBase.replace(/^\/+/, '')}${normalizedPath}`, `${siteUrl}/`).toString()
26-
}
27-
28-
const zhGettingStartedItems = [
29-
{ text: '先决条件', link: '/zh/getting-started/prerequisites' },
30-
{ text: '安装指南', link: '/zh/getting-started/installation' },
31-
{ text: '快速开始', link: '/zh/getting-started/quickstart' },
32-
]
33-
34-
const zhGuidesItems = [
35-
{ text: '学习路径', link: '/zh/guides/learning-path' },
36-
{ text: '性能分析指南', link: '/zh/guides/profiling-guide' },
37-
{ text: '验证与 Sanitizer', link: '/zh/guides/validation' },
38-
{ text: '优化决策树', link: '/zh/guides/optimization-decision-tree' },
39-
{ text: '最佳实践', link: '/zh/guides/best-practices' },
40-
]
41-
42-
const zhDeepDivesItems = [
43-
{ text: '内存布局', link: '/zh/deep-dives/memory-layout' },
44-
{ text: '无锁队列', link: '/zh/deep-dives/lock-free-queue' },
45-
{ text: 'SIMD 内部机制', link: '/zh/deep-dives/simd-internals' },
46-
]
47-
48-
const zhAlgorithmsItems = [
49-
{ text: '排序算法', link: '/zh/algorithms/sorting' },
50-
{ text: '哈希算法', link: '/zh/algorithms/hashing' },
51-
]
52-
53-
const zhExerciseItems = [
54-
{ text: '内存练习', link: '/zh/exercises/module-02-memory' },
55-
{ text: 'SIMD 练习', link: '/zh/exercises/module-04-simd' },
56-
{ text: '并发练习', link: '/zh/exercises/module-05-concurrency' },
57-
{ text: '解答', link: '/zh/exercises/solutions' },
58-
]
59-
60-
const zhReferenceItems = [
61-
{ text: '内存工具', link: '/zh/reference/api/memory-utils' },
62-
{ text: 'SIMD Wrapper', link: '/zh/reference/api/simd-wrapper' },
63-
{ text: 'Benchmark 工具', link: '/zh/reference/api/benchmark-utils' },
64-
{ text: '常见问题', link: '/zh/reference/faq' },
65-
{ text: '故障排查', link: '/zh/reference/troubleshooting' },
66-
]
67-
68-
export default withMermaid(defineConfig({
14+
export default defineConfig({
6915
title: siteTitle,
7016
description: siteDescription,
7117
base,
7218
cleanUrls: false,
7319
lastUpdated: true,
74-
mermaid: {
75-
startOnLoad: false,
76-
securityLevel: 'strict',
77-
flowchart: { useMaxWidth: true, htmlLabels: true },
78-
sequence: { useMaxWidth: true },
79-
gantt: { useMaxWidth: true },
80-
theme: 'base',
81-
themeVariables: {
82-
fontFamily: 'Inter, system-ui, sans-serif',
83-
fontSize: '14px',
84-
},
85-
},
8620
head: [
87-
['link', { rel: 'icon', type: 'image/svg+xml', href: assetPath('/logo.svg') }],
21+
['link', { rel: 'icon', type: 'image/svg+xml', href: `${base}logo.svg` }],
8822
['meta', { name: 'theme-color', content: '#3476f6' }],
8923
['meta', { property: 'og:type', content: 'website' }],
9024
['meta', { property: 'og:site_name', content: siteTitle }],
9125
['meta', { property: 'og:title', content: siteTitle }],
9226
['meta', { property: 'og:description', content: siteDescription }],
93-
['meta', { property: 'og:image', content: canonicalAssetUrl('/og-card.png') }],
94-
['meta', { property: 'og:image:alt', content: 'C++ 高性能指南文档社交卡片' }],
9527
['meta', { property: 'og:locale', content: 'zh_CN' }],
96-
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
97-
['meta', { name: 'twitter:image', content: canonicalAssetUrl('/og-card.png') }],
98-
['meta', { name: 'twitter:title', content: siteTitle }],
99-
['meta', { name: 'twitter:description', content: siteDescription }],
10028
['meta', { name: 'keywords', content: 'C++, 性能, SIMD, 并发, CMake, 基准测试, 内存布局, 无锁队列' }],
10129
],
10230
locales: {
@@ -116,12 +44,10 @@ export default withMermaid(defineConfig({
11644
copyright: `版权所有 © ${currentYear} C++ HPC Guide 贡献者`,
11745
},
11846
nav: [
119-
{ text: '入门', link: '/zh/getting-started/quickstart', activeMatch: '/zh/getting-started/' },
120-
{ text: '指南', link: '/zh/guides/learning-path', activeMatch: '/zh/guides/' },
47+
{ text: '入门', link: '/zh/getting-started', activeMatch: '/zh/getting-started' },
12148
{ text: '深度专题', link: '/zh/deep-dives/memory-layout', activeMatch: '/zh/deep-dives/' },
122-
{ text: '算法', link: '/zh/algorithms/sorting', activeMatch: '/zh/algorithms/' },
123-
{ text: '练习', link: '/zh/exercises/module-02-memory', activeMatch: '/zh/exercises/' },
124-
{ text: '参考', link: '/zh/reference/faq', activeMatch: '/zh/reference/' },
49+
{ text: '实战指南', link: '/zh/guides/profiling', activeMatch: '/zh/guides/' },
50+
{ text: '参考', link: '/zh/reference/api', activeMatch: '/zh/reference/' },
12551
],
12652
sidebar: {
12753
'/zh/': [
@@ -133,27 +59,33 @@ export default withMermaid(defineConfig({
13359
},
13460
{
13561
text: '入门',
136-
items: zhGettingStartedItems,
137-
},
138-
{
139-
text: '指南',
140-
items: zhGuidesItems,
62+
items: [
63+
{ text: '快速开始', link: '/zh/getting-started' },
64+
],
14165
},
14266
{
14367
text: '深度专题',
144-
items: zhDeepDivesItems,
145-
},
146-
{
147-
text: '算法',
148-
items: zhAlgorithmsItems,
68+
items: [
69+
{ text: '内存布局与缓存', link: '/zh/deep-dives/memory-layout' },
70+
{ text: 'SIMD 向量化', link: '/zh/deep-dives/simd-internals' },
71+
{ text: '无锁并发', link: '/zh/deep-dives/lock-free-queue' },
72+
{ text: '现代 CMake 构建', link: '/zh/deep-dives/cmake-build-system' },
73+
{ text: 'C++20 性能实践', link: '/zh/deep-dives/modern-cpp-perf' },
74+
],
14975
},
15076
{
151-
text: '练习',
152-
items: zhExerciseItems,
77+
text: '实战指南',
78+
items: [
79+
{ text: '性能分析实战', link: '/zh/guides/profiling' },
80+
{ text: '优化决策手册', link: '/zh/guides/optimization-playbook' },
81+
],
15382
},
15483
{
15584
text: '参考',
156-
items: zhReferenceItems,
85+
items: [
86+
{ text: 'API 参考', link: '/zh/reference/api' },
87+
{ text: '故障排查', link: '/zh/reference/troubleshooting' },
88+
],
15789
},
15890
],
15991
},
@@ -179,23 +111,10 @@ export default withMermaid(defineConfig({
179111
search: { provider: 'local' },
180112
logo: {
181113
light: '/logo.svg',
182-
dark: '/logo-dark.svg',
114+
dark: '/logo.svg',
183115
},
184116
socialLinks: [
185117
{ icon: 'github', link: 'https://github.com/LessUp/cpp-high-performance-guide' },
186118
],
187119
},
188-
vite: {
189-
plugins: [llmstxt()],
190-
build: {
191-
rollupOptions: {
192-
output: {
193-
manualChunks(id) {
194-
if (id.includes('mermaid')) return 'mermaid-lazy'
195-
if (id.includes('katex')) return 'katex-lazy'
196-
},
197-
},
198-
},
199-
},
200-
},
201-
}))
120+
})

docs/.vitepress/data/citations.yaml

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)