Skip to content

[0017] 优化 stack-size 为 O(1)#783

Merged
da-liii merged 3 commits into
mainfrom
da/0017/stack_size_perf
May 11, 2026
Merged

[0017] 优化 stack-size 为 O(1)#783
da-liii merged 3 commits into
mainfrom
da/0017/stack_size_perf

Conversation

@da-liii
Copy link
Copy Markdown
Contributor

@da-liii da-liii commented May 11, 2026

概要

优化 stack-size 从 O(n) 到 O(1),通过给 stack record-type 增加 size 字段。

变更内容

  1. 新增 bench/stack-size.scm 性能基准测试
  2. stack record-type 增加 size 字段,修改所有构造函数和修改器维护 size
  3. 新增 devel/0017.md 开发文档,更新测试注释

性能对比

栈大小 优化前 优化后
10 0.071s 0.057s
100 0.196s 0.065s
1000 1.828s 0.069s
10000 3.212s 0.008s
100000 4.804s 0.001s

测试

  • 全部 143 个 stack 测试用例通过

🤖 Generated with Claude Code

Da Shen and others added 3 commits May 11, 2026 14:01
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@da-liii da-liii merged commit c4560b0 into main May 11, 2026
4 checks passed
@da-liii da-liii deleted the da/0017/stack_size_perf branch May 11, 2026 06:08
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