### VDE-1251 linear_pattern 性能(100s→<0.2s) - 根因:linear_pattern 逐实例 brep_union(SSI 布尔),dense 体超线性;新增 pattern_assemble:AABB 相交判定 + 不相交 fast-concat(不做布尔,多体/shell,O(count·N+count²)),重叠保留精确 union; - PatternOptions/PatternStats/重载 + PatternResultEx degraded/error/stats + VDE_PROFILE_PATTERN 阶段计时; - 实测 dense F=6512 count=3 不相交 81-124ms(原 100-173s,面/边/顶点 3×);小 dense 体积 rel 7.2e-15、to_mesh/display 3×; valid 106 面板 validate/体积 3×;重叠结果与手动 union 一致(degraded=true);force_multi_body 重叠 ms 级; - test_vde1251_pattern_perf 8/8 + 相关 219 tests 全绿;VDE-1251 内核侧响应/benchmark 性能预期; ### P3-13 插件仓库索引 + 签名分发/安装 - plugins/index.json schema + docs/guides/plugin-distribution.md;tool --build-index/--verify-index/--install/--gen-keypair; - Ed25519 索引签名/artifact SHA-256/路径逃逸/ABI/重复条目校验;端到端 sample_vbox+sample_gcs + 负例; ### P3-14 外部服务能力路由 + 类型化适配 - services_with_capability/select/invoke_by_capability(priority 降序、失败回退、selected id、聚合错误);manifest priority; - external_service_adapters.h:GCS typed + CAE/CAM JSON 适配;test_plugin_external_service 27/27;协议/开发文档; ### P3-15 模块拆仓可行性 + render 包 - 审计 drafting/render/ui/pdm/mechanism(2 处 bridge TU);vde-render install/export + find_package,consumer RENDER_CONSUMER_PASS; - docs/design/module-packaging-split.md + architecture §7.9.5 + roadmap; ### 工程 - 版本 1.0.72(CMake/version.h/test_version/README/docs index/module-manual); - 全量构建 0 error(364 targets);全量 ctest 7516 注册、7421/7421 PASS(0 failed,25 skipped,288.86s)。
17 KiB
ViewDesignEngine 性能基准报告
自动生成于: 2026-07-27 下一更新: CI 每次运行后自动更新
1. 布尔运算性能
测试不同面数模型的布尔运算(并集/交集/差集)耗时。
| 测试名称 | 耗时 (ms) | 模型A面数 | 模型B面数 | 结果面数 |
|---|---|---|---|---|
| Boolean.Union/Small | - | - | - | - |
| Boolean.Union/Medium | - | - | - | - |
| Boolean.Union/Large | - | - | - | - |
| Boolean.Intersection/Small | - | - | - | - |
| Boolean.Intersection/Medium | - | - | - | - |
| Boolean.Intersection/Large | - | - | - | - |
| Boolean.Difference/Small | - | - | - | - |
| Boolean.Difference/Medium | - | - | - | - |
| Boolean.Difference/Large | - | - | - | - |
2. MC / Tessellation 性能
测试 SDF 求值和 B-Rep→Mesh 的 tessellation 耗时。
| 测试名称 | 耗时 (ms) | 分辨率 | 输出三角形数 |
|---|---|---|---|
| MC.Evaluate/LowRes-10pts | - | 10 | - |
| MC.Evaluate/MediumRes-1000pts | - | 1000 | - |
| MC.BrepToMesh/LowDeflection | - | - | - |
| MC.BrepToMesh/MediumDeflection | - | - | - |
| MC.BrepToMesh/HighDeflection | - | - | - |
| MC.BrepToMesh/ComplexModel | - | - | - |
3. 导入/导出性能
测试 IGES/STEP 格式的序列化和反序列化耗时。
| 测试名称 | 耗时 (ms) | 数据大小 (bytes) |
|---|---|---|
| IO.IGES.Export/SingleBox | - | - |
| IO.IGES.Export/Sphere16x8 | - | - |
| IO.IGES.Import/SingleBox | - | - |
| IO.STEP.Export/SingleBox | - | - |
| IO.STEP.Export/Sphere16x8 | - | - |
| IO.STEP.Export/Cylinder32 | - | - |
| IO.STEP.Import/SingleBox | - | - |
| IO.STEP.Export/LargeSphere32x16 | - | - |
| IO.IGES.Export/LargeSphere32x16 | - | - |
| IO.STEP.Export/MultiBody(4) | - | - |
4. 批量布尔(fuse_all, VDE-170)性能
自包含 chrono 基准(tools/bench_batch_boolean.cpp),Release 库(build-rel),
取 2 次中位数。对比 fuse_all(两两递归 + AABB 空间分区)与朴素逐对合并(naive)。
测试环境: Windows, MinGW GCC 8.1.0, -O2 -std=c++2a -fopenmp, Release 构建。
4.1 Disjoint(不相交链,AABB 扫描 + 壳拼接开销)
| N | fuse_all (ms) | naive (ms) | speedup |
|---|---|---|---|
| 50 | 307.9 | 288.4 | 0.94x |
| 100 | 1243.9 | 1125.0 | 0.90x |
| 200 | 5489.6 | 5415.0 | 0.99x |
4.2 Overlap(重叠晶格,真实布尔合并工作量)
| N | fuse_all (ms) |
|---|---|
| 5 | 1057.9 |
| 10 | 2156.6 |
| 20 | 4102.9 |
4.3 结论
- fuse_all 相对朴素逐对合并无性能优势(speedup 0.90~0.99x),两两递归 + AABB 分区在千级以下场景的扫描开销与朴素合并相当。
- Overlap 场景耗时近似线性增长(N 翻倍约 2x),说明单次布尔仍是主导成本。
- 后续优化方向(对应阶段 1/2):先按 AABB 连通分量分块合并(每块独立 fuse,互不相交 块直接 join shell),再引入 BVH 空间分区批量面-面求交。
说明
- 表内
-表示尚未运行基准测试,请通过ctest -R Benchmark运行后更新 - 所有耗时取 3~5 次迭代的最佳值
- 模型面数基于
BrepModel::num_faces()统计 - 环境: 本表历史数据为 Ubuntu 22.04 / GCC 11 / Release;当前 Windows 环境为 MinGW GCC 16.1.0 / Release / -O3 -DNDEBUG + OpenMP
2026-10-26 基线实跑(task-54,build-verify3/benchmark_baseline.md)
- 26/26 基准全部 PASS,串行总耗时 42.59 s(
ctest --output-on-failure -R Benchmark,Windows MinGW GCC 16.1.0 / Release)。 - 上述"说明"节提到的 25 个
-行已全部补齐(逐项 ms/面数/字节数见build-verify3/benchmark_baseline.md), 代表性数据:Boolean.Union/Large 1695.62 ms、Boolean.Difference/Large 2716.57 ms、 MC.BrepToMesh/HighDeflection 484.99 ms、STEP Export/LargeSphere 27.79 ms、IGES Export/LargeSphere 51.94 ms; 另新增 InstanceRender 百万实例基准 0.24 s。 - 仍缺:§4
fuse_all表与大文件端到端基线(docs/reference/32的 1.9 MB STEP 场景)尚未自动化; 当前无性能回归门禁,计划纳入 nightly(见40C-4 / 阶段 1-5)。
2026-10-26 基准自动化 + 性能门禁(Wave3 C-4,audit-brep)
6.1 环境与套件
- 环境:Windows 11 / MinGW-w64 GCC 16.1.0 / Release / OpenMP;构建目录
build-curves2。 ctest -R Benchmark:29/29 PASS(26 项既有基准 + 3 项新增大文件三段),总耗时 16.3–18.5 s (同一套件历史记录 42.59 s;B-8 优化后关键项显著下降)。- 自动化入口:
tools/bench/run_bench.ps1;基线:tools/bench/baseline.json; 最近结果:tools/bench/results/latest.json/latest.md(含原始 ctest 输出ctest_benchmark_raw.txt)。
6.2 当前实测([BENCH] 28 条,2026-10-26 基线)
| 基准 | ms | 上限 ms | 基准 | ms | 上限 ms |
|---|---|---|---|---|---|
| Boolean.Union/Small | 35.45 | - | IO.IGES.Export/SingleBox | 0.36 | - |
| Boolean.Union/Medium | 175.65 | 600 | IO.IGES.Export/Sphere16x8 | 11.47 | - |
| Boolean.Union/Large | 783.87 | 2,000 | IO.IGES.Import/SingleBox | 0.24 | - |
| Boolean.Intersection/Small | 20.39 | - | IO.STEP.Export/SingleBox | 0.10 | - |
| Boolean.Intersection/Medium | 106.28 | 400 | IO.STEP.Export/Sphere16x8 | 5.72 | - |
| Boolean.Intersection/Large | 464.63 | 2,500 | IO.STEP.Export/Cylinder32 | 0.85 | - |
| Boolean.Difference/Small | 17.92 | - | IO.STEP.Import/SingleBox | 0.22 | - |
| Boolean.Difference/Medium | 89.11 | 400 | IO.STEP.Export/LargeSphere32x16 | 29.10 | 500 |
| Boolean.Difference/Large | 381.10 | 3,500 | IO.IGES.Export/LargeSphere32x16 | 50.38 | 800 |
| MC.Evaluate/LowRes-10pts | ~0.00 | - | IO.STEP.Export/MultiBody(4) | 3.27 | - |
| MC.Evaluate/MediumRes-1000pts | 0.01 | - | LargeFile.Import_9MB | 702.54 | 1,500 |
| MC.BrepToMesh/LowDeflection | 5.11 | 800 | LargeFile.Heal_Sphere544 | 39.89 | 200 |
| MC.BrepToMesh/MediumDeflection | 80.98 | 800 | LargeFile.ExportGLB_Res32 | 707.95 | 1,500 |
| MC.BrepToMesh/HighDeflection | 544.47 | 800 | |||
| MC.BrepToMesh/ComplexModel | 45.99 | 800 |
数值取 benchmark 内部"多次迭代最优";受共享机器负载影响,同项不同次可波动 ±10–20%。 单独运行大文件三段时的最佳观测:import 513.51 ms / heal 33.73 ms / GLB 566.32 ms (baseline.json 采用一次完整套件运行的值,用于相对回归门禁)。
6.3 性能门禁
- 绝对上限:见上表"上限 ms"列(按当前环境实测约 2x 余量校准;C-4 约定: Boolean.Union/Large ≤2 s、Difference/Large ≤3.5 s、MC.BrepToMesh ≤0.8 s 均满足)。
- 相对回归:与
tools/bench/baseline.json比,超 +20% 判违规(基线 <2 ms 的微基准跳过,噪声地板)。 - 套件门禁:
ctest -R Benchmark任一失败也判违规。 -Check模式 violation → exit 1;实测:正常跑GATE PASS (exit 0); 人为把基线调低 30% 模拟退化 →Boolean.Difference/Large +59.5% > 20%,GATE FAIL (exit 1)✓。
6.4 大文件三段基线(tests/benchmark/bench_large_file.cpp)
夹具:40 × sphere(16,8) = 5120 面 / 9.32 MB STEP(引擎 export_step 现场生成,不计时);
heal/导出采用 544 面闭合球。与 docs/reference/32 历史基线(21.9 MB / 4941 面真实语料)量级对照:
| 段 | 当前基线 (ms) | docs/reference/32 历史 (ms) | 说明 |
|---|---|---|---|
| STEP import(parse+convert) | 702.54(最佳 513.51) | 16,300(parse 4,400 + convert 11,500) | B-8 tokenizer/实体表优化 |
| automatic_heal | 39.89(最佳 33.73) | 113,700 | B-8 方向快路径(Orient 996→2 ms) |
| write_brep_gltf(res=32) | 707.95(最佳 566.32) | 124,700 | B-8 三角汤直写 GLB(跳过 HalfedgeMesh build 1330 ms) |
(历史值为真实 21.9MB 语料 + Ubuntu/GCC11 时代数据;当前为 9.32MB 合成 + Windows/MinGW GCC16,
非同一夹具,故只做量级/优化方向对照;同夹具 before/after 见 build-curves2/perf_report.md。)
6.5 用法(日间 / 夜间 / CI)
``powershell
刷新基线(仅在有意优化并通过人工确认后)
pwsh tools/bench/run_bench.ps1 -UpdateBaseline
夜间/CI 门禁(超绝对上限或相对回归 >20% → 非零退出)
pwsh tools/bench/run_bench.ps1 -Check -RegressionPct 20
日间快速检查(跳过 rebuild)
pwsh tools/bench/run_bench.ps1 -Check -NoBuild ``
CI(任意 PowerShell runner,无外部依赖):
``yaml
- name: VDE benchmark gate shell: powershell run: | powershell -NoProfile -ExecutionPolicy Bypass -File tools/bench/run_bench.ps1 -Check -RegressionPct 20 ``
说明:默认 ctest 仍排除 Benchmark(既有约定不变),性能回归仅在显式 benchmark 任务/门禁脚本中拦截;
详见 tools/bench/README.md 与 tools/bench/results/latest.md。
2026-10-26 门禁噪声校准(task-80 / C-4 后续)
问题
小基准(Boolean.Union/Small ≈35 ms、Intersection/Small ≈20 ms)受进程启动与共享机器负载影响,
同项相邻运行偏差可达 +23% / +48% / +164%,旧规则(噪声地板 2 ms + 20% 相对阈值)会误报 GATE FAIL。
校准规则(tools/bench/run_bench.ps1)
- 相对阈值默认 25%(
-RegressionPct 25);同时要求绝对增量 > max(5 ms, 10% × baseline); baseline < 50 ms的基准为 report-only(MONITOR):超阈值只记录不判违规,绝对上限(CAP)仍生效; 需要严格判定时用-StrictSmallBench;- 空闲窗口执行
-UpdateBaseline刷新基线(28 条 [BENCH],见tools/bench/baseline.json)。
连续两次门禁证据(2026-10-26)
| 次数 | 套件 | 结果 | 备注 |
|---|---|---|---|
| #1 | 29/29 Benchmark tests PASS,28 benches,13.31 s | GATE PASS (exit 0) | 全部 OK,无违规 |
| #2 | 29/29 Benchmark tests PASS,28 benches,15.84 s | GATE PASS (exit 0) | Boolean.Intersection/Small 51.30 ms vs baseline(+164.3%) → MONITOR(非违规) |
说明:第二次运行正好复现旧规则会误报的小基准抖动场景,校准后正确降级为 MONITOR; 大基准(Boolean.Union/Large、LargeFile 三段、MC.BrepToMesh)仍受 25% 相对门禁 + 绝对上限双重约束。
2026-10-26 冻结基线重标(task-86 后,Lead/ifc-dev 决策)
- 旧 baseline 作废:冻结前
tools/bench/baseline.json由 stale bench exe(wave 前链接)生成, 已被 verifier 首跑定位为失真来源(build-verify3/final_verify_report.md§4)。 - 新 baseline:由修复后的
run_bench.ps1($Args自动变量遮蔽 bug 修复 + stale exe 自动重链 +-ForceRebuild)在干净冻结全构建上-UpdateBaseline生成,28 条 [BENCH]; 连续两次-CheckGATE PASS(suite 15.23 s / 14.89 s)。 - 相对旧 stale 基线的变化与决策:Intersection/Difference 的 Small/Medium 回升 (Intersection/Medium 92.89→165.93 ms、Difference/Medium 87.99→262.93 ms、 Intersection/Large 462.07→602.81 ms、Difference/Large 366.89→815.28 ms), 属 task-86 保留正确性/精确补救阶梯的成本(非回退正确性);Large 全部在 CAP 内, Union 全面优于旧基线(Union/Large 704→227.78 ms,-67.7%)。记录待后续优化。
- 最终 Boolean 关键值(verifier 独立矩阵,冻结 HEAD
6564de10):Micro_Union_BoxBox 0.366 ms、 Union/Large 224.14 ms、Intersection/Large 580.87 ms、Difference/Large 798.57 ms(±6% 内全部 OK)。
2026-10-26 Phase4 重标(task-94,冻结 HEAD 2fd06748)
Phase4(G3/Class-A、PRC、XT/SAT/JT 外部解析、反求 G2/G3、LAZ、GPU/HIP、精确谓词、Python ctypes) 在冻结
build/(818/818)上复跑 benchmark:tools/bench/run_bench.ps1 -BuildDir build -ForceRebuild -Check。 首次对 Wave3 基线出现 6 项 >25% 相对回归(绝对 CAP 全部未超):
| Benchmark | 首跑 (ms) | Wave3 基线 (ms) | Δ | CAP (ms) | 判读 |
|---|---|---|---|---|---|
| Boolean.Union/Large | 309.53 | 227.78 | +35.9% | 2,000 | 精确谓词/布尔质量修复成本 |
| Boolean.Union/Medium | 83.83 | 66.11 | +26.8% | 600 | 同上 |
| Boolean.Intersection/Large | 941.28 | 602.81 | +56.2% | 2,500 | 同上 |
| Boolean.Difference/Large | 1,037.96 | 815.28 | +27.3% | 3,500 | 同上 |
| MC.BrepToMesh/HighDeflection | 436.99 | 339.51 | +28.7% | 800 | Phase4 曲面/细分质量投入 |
| MC.BrepToMesh/MediumDeflection | 76.91 | 60.27 | +27.6% | 800 | 同上 |
判读:6 项均 远低于 CAP,属 Phase4 正确性/精度(Shewchuk 精确谓词接入 SSI/布尔退化判定、 G3/Class-A 曲面与反求质量、tessellation 质量控制)的阶梯成本,与 task-86 后既定策略一致 (正确性 > 精度 > 性能);Wave3 基线已不能代表 Phase4 行为。按流程重标并在干净窗口连续两次门禁:
``powershell pwsh tools/bench/run_bench.ps1 -BuildDir build -ForceRebuild -UpdateBaseline
-> baseline updated: tools/bench/baseline.json (28 benches), generated 2026-10-26T07:16:56+08:00, suite 18.24 s
pwsh tools/bench/run_bench.ps1 -BuildDir build -Check # 29/29 PASS, 17.15 s, GATE PASS (0 violation) pwsh tools/bench/run_bench.ps1 -BuildDir build -Check # 29/29 PASS, 15.02 s, GATE PASS (0 violation) ``
Phase4 新基线关键值(旧 → 新,ms):
| Benchmark | Wave3 基线 | Phase4 基线 | 说明 |
|---|---|---|---|
| Boolean.Union/Large | 227.78 | 289.39 | +27.1%;CAP 2,000 内 |
| Boolean.Union/Medium | 66.11 | 74.44 | +12.6% |
| Boolean.Intersection/Large | 602.81 | 676.02 | +12.1% |
| Boolean.Intersection/Medium | 165.93 | 180.96 | +9.1% |
| Boolean.Difference/Large | 815.28 | 906.77 | +11.2% |
| Boolean.Difference/Medium | 262.93 | 283.58 | +7.9% |
| MC.BrepToMesh/HighDeflection | 339.51 | 349.76 | +3.0% |
| MC.BrepToMesh/MediumDeflection | 60.27 | 63.97 | +6.1% |
| MC.BrepToMesh/ComplexModel | 29.6(由首跑 +20.4% 反算) | 31.22 | 报告值 |
| LargeFile.Import_9MB | 431.26 | 458.47 | +6.3% |
| LargeFile.Heal_Sphere544 | 30.34 | 32.58 | +7.4% |
| LargeFile.ExportGLB_Res32 | 432.34 | 494.15 | +14.3% |
证据:
build/audit_phase4/bench_update.log(UpdateBaseline)、bench_check2.log、bench_check3.log(连续两次 GATE PASS)、tools/bench/results/latest.md、tools/bench/baseline.json(28 benches, generated_at2026-10-26T07:16:56)。小基准(<50 ms)仍 report-only;大基准 CAP + 25% 相对门禁双重生效。
VDE-1251:pattern 算子性能预期(2026-10-29)
linear_pattern / linear_pattern_spacings / pattern_at_positions 对互不相交
实例走 fast-concat(不调用布尔),对重叠实例保留精确 union;grid_pattern / skip /
linear_pattern_ex(Geometry) 同享该装配路径。以下为 Release / MinGW UCRT g++ /
24 核机器上的实测基线(夹具与断言见 tests/brep/test_vde1251_pattern_perf.cpp):
| 场景 | 体规模 | 路径 | 预期耗时 | 备注 |
|---|---|---|---|---|
| dense facet 体(5×5 孔 → to_mesh(0.01) 转 B-Rep)count=3 不相交 | F=6512 E=19536 | fast-concat | ≈80–170ms(准备/变换 ≈50–100ms,装配 ≈25–45ms) | 目标 <1s;宿主 6518-tri offset 体场景 |
| 同上 count=3 重叠(间距 10) | F=6512 | 精确 union | 分钟级(本次实测 >169s 未完成) | 契约:degraded=true + union_count=2;dense 重叠阵列请改用 PatternMode::MultiBody |
| 106 面多孔板 count=3 不相交 | F=106 | fast-concat | ≈1–5ms | — |
| 106 面多孔板 count=3 重叠 | F=106 | 精确 union | ≈23s | 与旧行为一致(未优化重叠 union) |
| 小 dense 体 count=3 不一致性校验 | F=1040 | fast-concat | ≈0.3–0.6s(含体积/to_mesh/display 断言) | 体积 rel≈1e-15,三角数严格 3× |
复杂度上界:
- 不相交 fast-concat:O(C·N + C²)(N=实例面数,C=count),纯内存拷贝/装配;
- 重叠精确 union:O(C) 次布尔,单次最坏 O(N²)
(N³)(SSI / 面片分类),dense 体上秒分钟级。
重叠 dense 阵列的快速逃生口(opt-in):PatternOptions::force_multi_body=true 强制多体
fast-concat(体积非 union 口径,仅几何/display 用);常规重叠默认仍精确 union。
诊断:VDE_PROFILE_PATTERN=1(或 PatternOptions::profile=true)输出
[pattern][VDE-1251] instances=… path=concat|union disjoint=… union_count=… prepare=…ms bbox=…ms concat=…ms union=…ms total=…ms。
回归门限:test_vde1251_pattern_perf 中宿主同量级 dense 不相交 count=3 断言
<1000ms(硬上限 <2000ms)且 stats.fast_concat_used=true。