Skip to content

[1215] 优化 subtree 性能并补充 Doxygen 文档、单元测试与基准 - #4367

Merged
da-liii merged 3 commits into
MoganLab:mainfrom
da-liii:da/1215/path
Aug 18, 2026
Merged

[1215] 优化 subtree 性能并补充 Doxygen 文档、单元测试与基准#4367
da-liii merged 3 commits into
MoganLab:mainfrom
da-liii:da/1215/path

Conversation

@da-liii

@da-liii da-liii commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What

优化 subtreemoebius/Kernel/Types/path.cpp)的性能,并补充 Doxygen 文档、单元测试与 nanobench 基准。

Why

subtree 是「path → 子树」的唯一入口,编辑/排版热路径上高频调用。原实现为递归、path 按值传参(引用计数原子操作)、每层 N(t)t[i] 重复做 compound 检查。

How

  • 递归改迭代;参数改 const path&- 每层单次 is_compound+ 边界检查;顺带修正负索引会t[-1]` 越界的问题
  • subtree/has_subtree/parent_subtree 补充中文 Doxygen 注释
  • 新增 path_bench.cpp(moebius nanobench),新增 subtree/parent_subtree 测试用例

bench(releasedbg,ns/op,5 次取中位数)

基准 加速比
subtree 深路径命中(16 层) 104.8 95.1 1.10x
subtree 浅路径命中 14.6 9.5 1.53x
parent_subtree 80.2 47.0 1.71x
has_subtree 190.7 ~100 ~1.9x

moebius_tests/* 16/16 通过。

🤖 Generated with Claude Code

da-liii and others added 2 commits August 18, 2026 15:59
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@da-liii
da-liii merged commit 3cfeba7 into MoganLab:main Aug 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant