docs: record lazy index performance and full graph verification

This commit is contained in:
阿白叔 committed 2026-10-19 10:20:17 +08:00
1 parent 998d78dbc0
commit 13b9ff48dd
3 files changed
+224

No files matched your search

@@ -74,3 +74,5 @@
403.625 秒仍高于建议的同样例 180 秒目标。剩余主要成本为必要的完整 COM 采集和每项保存重开;若继续提速,需要认证更快的完整读取接口,或单独改造图页事务及恢复协议。当前不能直接跨 CAD 修改使用旧快照。
Cell Name 与新 Part Name 的封装映射证明、复杂层级/多 gate 实机认证、现有 1000 步性能门槛仍按准确性审查报告保留,未因本轮提速宣称已解决。
后续 [器件索引按需采集优化](2026-10-19-lazy-component-indexes.md) 已将同源工程单轮实测进一步降至 **375.688 秒**;本报告的 403.625 秒保留为前一阶段基线。
@@ -0,0 +1,53 @@
# 器件索引按需采集优化
在上一轮重复步骤修复 `2ad36ba` 基础上继续优化。正式代码提交为 `8fe82c3`,追加防护用例为 `998d78d`。本轮不打包、不发布,不改变逐项保存、磁盘重开和故障恢复协议。
## 本轮修改
- 采集直接遍历已查询的器件集合,移除随后没有消费者的完整定位索引。未命中任务不再为定位索引读取器件坐标。
- 精确 UID 范围只对目标器件执行旧料号和 Value 的匹配查询;未选中器件仍由同一次完整 C/A 快照生成 U/G 基线。全匹配模式仍检查全部器件的旧料号,读取错误仍向上传递。
- 恢复定位先建立 UID 索引;UID 缺失才采集位号,位号也未找到才采集坐标。三种索引保留重复项,不把冲突器件静默覆盖或丢弃。
- 索引只在原有当前上下文中复用;建立前后核对工程和图页,工程/图页变化或显式失效后重新采集。替换、保存重开后的刷新及保存前、磁盘重开后的完整检查均保留。
这里没有跨料号规则缓存完整页快照,也没有合并多个规则的保存事务。只把未使用的读取移除,把备用定位字段延迟到实际需要时读取。
## 回归与审查
先以实际 cscript 运行生产函数复现:未命中仍读取坐标、精确选择查询了无关器件的 FindAttribute、UID 已命中仍读取备用坐标。修复后这些反例通过。
- 执行、恢复、VBS、脚本合同及自动替换回归:**147 passed,43.59 秒**。
- 追加定位保护:**7 passed,3.73 秒**;其中 1 项与上述套件重叠,不能将两组数量相加。覆盖 UID/位号/坐标冲突、共享 UID 的备用桶、显式失效、工程上下文变化后重新读取坐标。
- 完整脚本经 Option Explicit 编译检查,未启动 CAD。
- 独立审查未发现 Critical/Important 问题;建议补充的冲突与上下文变化用例已补齐。
## 同源工程实机验证
从原始 Audio 工程创建全新 `build/lazy-index-formal-bom-20261019/project/` 副本,运行与上一轮相同的流程:创建任务 → 导出默认 BOM → 填入 RV05/RV14 两条替换 → 数值型新料号反例拒绝且不保存计划 → 修正为文本 → 导入预览 → 确认 → 正式顺序执行 → 每项保存重开 → 独立原生库存及 ASCII 读回。
| 指标 | 上一轮 | 本轮 |
| --- | --- | --- |
| 两条规则的正式队列总耗时 | 403.625 秒 | **375.688 秒** |
| 耗时减少 | — | **27.937 秒,6.92%** |
| 首项执行器耗时,含自有 CAD 启动 | 232.011 秒 | 230.117 秒 |
| 第二项执行器耗时 | 166.829 秒 | 140.349 秒 |
| 成功保存 / 失败 | 2 / 0 | 2 / 0 |
相对最初 799.50 秒基线,当前样例累计减少 **53.01%**。这三次均是同机、同库、同源工程的单轮测量,运行时负载和缓存并不完全相同,不能据此承诺其他工程均有相同收益。第一项总耗时变化很小,也说明局部减少调用不等于每一阶段都会按比例变快。
完整保护证据:
- RV05/RV14 新料号均为 `4100-CA0000-T0`,Value 分别为 `0R`、`0R/NC`,原 UID 保留。
- 第一项原始快照排除路径元数据后,**120 行内容多重集与上一轮完全相同**,没有减少采集字段。
- 独立层级、扁平导出均核对 **57 个器件、103 个引脚、22 个网络**;55 个未选中器件及所有引脚连接、网络关系不变。
- 本轮最终层级、扁平导出的完整图数据与上一轮最终结果完全相等,比较保留属性、引脚及连接内容,仅忽略同层行顺序。
- 来源 `.prj` 和 `icdb.dat` 哈希不变;自有 CAD、私有桌面释放通过,未接管主桌面前台。
运行前记录脚本和 helper 的 SHA256,核对与当前源码一致。机器证据见 [JSON](../testing/evidence/2026-10-19-lazy-component-indexes.json)。原始报告、桌面观察、快照及导出留在忽略的 `build/lazy-index-formal-bom-20261019/`、`build/lazy-index-ascii-result-20261019/` 中,不提交工程或厂商文件。
## 后续边界
本机类型库确认有 `IVdComp.GetBatchAttributes` 和 `GetBatchOats`。参考手册的 Component Object 章节(PDF 页 297–298)将返回格式描述为 `Visibility Name=Value<CR>`;没有坐标、字体、颜色等完整快照字段,因此本轮未用它替代完整采集,也未声称已经完成本机现场等价认证。源手册位于 AppTraceRecorder/reference/SiemensEDA_Python_Interface/xpedition_designer/SEDA_Xpedition_Designer_automation/designer_auto_ref.pdf。
1000 步模拟队列在修改前的 cProfile + tracemalloc 定位运行中为 **36.198 秒**、峰值约 **2.17 MiB**,仍未通过 30 秒门槛。剖析指向逐项命令原子发布、日志写入和文件状态检查;本轮仅修改 VBS,未改变 Python 队列持久化,也未通过减少可靠落盘来让门槛通过。该结果包含剖析开销,不是 CAD 实际替换吞吐量。
当前样例仍高于建议的 180 秒目标。若需大幅继续提速,应认证能够返回完整保护字段的批量读取路线,或单独改造图页事务、取消及恢复协议。Cell Name 映射证明、复杂层级/多单元/多 gate 认证等既有发布缺口继续保留。
@@ -0,0 +1,169 @@
{
"date": "2026-10-19",
"production_code_commit": "8fe82c3",
"additional_guard_tests_commit": "998d78d",
"code_hashes": {
"integration/dxdesigner795/QuickPartReplace.vbs": "4e6ad90e54644444a39b863b60bce50acd2e5a7ddaf17eb99b8840316febf0ae",
"src/dx_productivity/trial_task_center/native_helper.py": "53b5f962de2a84c99b42a78e9b3046239f7bb4c99b8730e8de085893cbd35188"
},
"regressions": {
"final-vbs-regressions": {
"tests": "147",
"failures": "0",
"errors": "0",
"time": "43.189"
},
"association-guards": {
"tests": "7",
"failures": "0",
"errors": "0",
"time": "2.953"
}
},
"test_overlap_note": "Seven association guards include one case already in the 147-test suite; do not sum counts.",
"formal_bom": {
"verified": true,
"baseline_seconds": 403.625,
"seconds": 375.688,
"time_reduction_percent": 6.9215,
"original_baseline_seconds": 799.5,
"original_baseline_reduction_percent": 53.0096,
"saved_items": 2,
"failed_items": 0,
"source_hashes_unchanged": true,
"snapshot_equivalence": {
"equal_excluding_path_metadata": true,
"baseline_rows": 120,
"optimized_rows": 120,
"baseline_only_rows": 0,
"optimized_only_rows": 0
},
"graph_summary": {
"hier": {
"component_count": 57,
"pin_count": 103,
"net_count": 22,
"unchanged_components": 55,
"all_pin_connections_unchanged": true,
"net_graph_unchanged": true
},
"flat": {
"component_count": 57,
"pin_count": 103,
"net_count": 22,
"unchanged_components": 55,
"all_pin_connections_unchanged": true,
"net_graph_unchanged": true
}
},
"previous_result_graph_equivalence": {
"hier": {
"equal": true,
"components": 57,
"pins": 103,
"nets": 22,
"sha256": "32b36adbef100db505ea3d98ca628d50a94c91826d7289d90e473b3f9c864a31"
},
"flat": {
"equal": true,
"components": 57,
"pins": 103,
"nets": 22,
"sha256": "acbb89d93ebd3dc35f7d4b794df943c2ef5d164a0fb0c1626c432d2a0aa5b033"
}
},
"step_timings": [
{
"old_part_number": "4100-CA0000-T7",
"elapsed_seconds": 230.1173034000094,
"worker_stage_seconds": {
"starting": 0.39100000000325963,
"session_startup": 1.077999999979511,
"check_project": 0.03200000000651926,
"open_project": 16.68700000003446,
"open_sheet": 5.155999999959022,
"session_ready": 0.0470000000204891,
"query_components": 0.0470000000204891,
"find_components": 1.0309999999590218,
"index_pins": 12.329000000085216,
"snapshot_attributes": 0.9689999999827705,
"capture": 0.01600000000325963,
"capture_untouched": 46.95299999997951,
"before_native": 0.2029999999795109,
"native_replace": 20.57800000003772,
"restore_preflight": 0.6879999999655411,
"index_components": 2.26500000001397,
"before_restore_transaction": 1.3119999999762513,
"restore_attribute_fields": 4.203000000037719,
"restore_attributes": 0.0,
"verify_restoration": 0.8910000000032596,
"verify_attribute_fields": 0.9059999999590218,
"finished": 0.5619999999762513,
"verify_untouched": 78.59399999998277,
"save_and_close": 3.0310000000172295,
"verify_saved_project": 0.0,
"session_wait": 0.0
}
},
{
"old_part_number": "4100-CA1030-T7",
"elapsed_seconds": 140.34872389998054,
"worker_stage_seconds": {
"check_project": 0.045999999914783984,
"open_sheet": 1.3290000000270084,
"query_components": 0.015000000013969839,
"find_components": 0.5469999999622814,
"index_pins": 9.749999999883585,
"snapshot_attributes": 0.6410000000614673,
"capture": 0.030999999959021807,
"capture_untouched": 32.86000000004424,
"before_native": 0.1559999999590218,
"native_replace": 22.18800000002375,
"restore_preflight": 0.6080000000074506,
"index_components": 1.296000000089407,
"before_restore_transaction": 1.0,
"restore_attribute_fields": 4.375,
"restore_attributes": 0.0,
"verify_restoration": 0.9529999999795109,
"verify_attribute_fields": 0.9219999999622814,
"finished": 0.7349999999860302,
"verify_untouched": 58.188000000081956,
"save_and_close": 1.7660000000032596,
"verify_saved_project": 0.0,
"open_project": 2.7820000000065193,
"session_wait": 0.0
}
}
]
},
"isolation": {
"owned_cad_exit_confirmed": true,
"owned_desktops_released": true,
"input_desktop_unchanged": true,
"owned_cad_became_foreground": false,
"observer_errors": []
},
"remaining_queue_performance_failure": {
"mode": "simulated_worker_with_tracemalloc",
"projects": 20,
"sheets_per_project": 5,
"rules_per_sheet": 10,
"steps": 1000,
"saved_steps": 91,
"elapsed_seconds": 36.19810440001311,
"peak_bytes": 2273365,
"steps_per_second": 27.625756005047542,
"target_seconds": 30,
"passed": false
},
"bulk_attribute_candidate": {
"installed_typelib_has_method": true,
"enabled_in_production": false,
"reason": "Documented return has visibility/name/value only; lacks location/font/color/size/orientation required for complete snapshots. Not a live equivalence certification."
},
"limitations": [
"One same-source run per revision; load and cache differences preclude a general speed guarantee.",
"375.688 seconds remains above the proposed 180-second target.",
"PCB Cell Name mapping and complex multi-gate/hierarchical certification remain unresolved."
]
}