Commit 232da7a
committed
feat(bench): measure bazel's C++20 modules, and split "edit" into what it means
—— 四处让这份 benchmark 从「看起来对」变成「说得清」
**bazel 其实支持模块,写死的 `supports=false` 抹掉了一整列真实数据。**
实测 bazel 9.2.0 + rules_cc 0.2.22:`module_interfaces` 属性存在,
配 `--experimental_cpp_modules` + `--features=cpp_modules`(缺任一个报不同的错)
与 **clang** 能构建并运行模块程序;配 **gcc** 则死在它自己的扫描器:
`aggregate-ddi failed ... Invalid JSON string` —— 它解析不了 GCC 的 P1689 输出。
所以能力判断不是引擎的属性,而是引擎×编译器的属性,`supports()` 因此收下 compiler。
meson 1.10.2 的理由也改成实测原文(`module 'fx.a' not found`),不再是断言。
`--force_pic` 是模块单元能跑起来的前提:cc_binary 为 PIC 与非 PIC 两套目标文件
各注册一次 ddi 聚合动作,却共用 `<target>.CXXModules.json` 这一个输出名,
分析阶段就崩(`unit_0.pic.ddi` vs `unit_0.ddi`, `Outputs: are equal`)。
选 PIC 而不是 `-supports_pic`,因为它产出 PIE —— 和其他引擎的默认产物一致。
**`edit-body` 插的是注释,于是每一个「改代码快 N 倍」的数字其实在说注释。**
拆成两个场景:`edit-body` 插入带 nonce 的 `volatile` 语句(真改 codegen,
nonce 在标识符里 —— 固定名字会在第 2 轮重复声明把构建打挂),
`edit-comment` 往被广泛导入的接口单元插注释(字节变、接口没变)。
顺带记下一个反直觉的实测结论:GCC 16.1 **不把导出非模板函数的函数体写进 BMI**,
所以改函数体不重编导入者是**对的**。判据必须带对照组 —— 同一份源码编译两遍,
差的是同样两个偏移,落在 `buildtime:`/`localtime:` 的秒位上。
**相对路径的引擎二进制一直是不可用的。** 每条被测命令的 cwd 都是被测工程,
所以 `--engines mcpp=./mcpp-old` 解析到了 fixture 目录,整个矩阵报 `exited -1`
而日志是空的。规格转引擎的那一处统一锚定成绝对路径;裸名仍走 PATH。
同时把「起不来」和「跑了但失败」在措辞上分开——前者不再指向一个从未写入的日志。
**`touch-leaf` 定义了、文档写了、`--help` 也列了,却从未跑过**:它不在默认场景表里。
默认表改成全部六个,CI 的 `scenarios` 默认值同步。
引擎版本现在由引擎自己写进结果文件(cmake 4.0.2 / xmake v3.0.7+HEAD / bazel 9.2.0),
之前只记了 "cmake + ninja",数据自己说不清是哪个 cmake 产的;xmake 的彩色 banner
要剥 CSI,而按 `@`-`~` 直接扫会停在 `[` 上、留下每个 reset 的 "0m"。
结果:`bench/results/five-way-20260812.md` 两张完整矩阵(gcc / clang × 六引擎 ×
三变体 × 六场景,cmake 为基准)。gcc 模块增量 mcpp 0.29s vs cmake 10.29s(35×),
vs 上一版 mcpp 3.65s(12.5×);clang 下 cmake 冷构建自身快 3.3×,bazel 3.19s 参赛,
xmake 每一个模块增量都是 ~12.6s。
测试:e2e 230 增两项 —— 相对引擎路径必须解析,引擎 note 不得含 ANSI 转义。
本地 82/82 单测通过,e2e 230 通过。1 parent 57783af commit 232da7a
20 files changed
Lines changed: 3767 additions & 969 deletions
File tree
- .agents/docs
- .github/workflows
- bench
- results
- src
- engines
- fixture
- tests/e2e
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| |||
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
205 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
129 | 147 | | |
130 | 148 | | |
131 | 149 | | |
| |||
164 | 182 | | |
165 | 183 | | |
166 | 184 | | |
167 | | - | |
168 | | - | |
169 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
170 | 215 | | |
171 | 216 | | |
172 | 217 | | |
| |||
0 commit comments