perf(vm): reuse linked Atoms for static property names - #12
Open
Eric-Song-Nop wants to merge 5 commits into
Open
perf(vm): reuse linked Atoms for static property names#12Eric-Song-Nop wants to merge 5 commits into
Eric-Song-Nop wants to merge 5 commits into
Conversation
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #11. Base:
perf/array-own-key-early-check; head:perf/static-property-atoms, both inpocket-stack/quickjs-oxide. Review and merge in dependency order.Migrated from Eric-Song-Nop#2 with identical commits and preserved measurement/validation evidence.
修改 / Change
Static-name operations used to fetch a String constant and intern it on every execution. Link those names to runtime-local Atoms once at publication and reuse a constant-indexed map in normal calls and resumed activations. Preserve String constants, serialized representation and existing PropertyKey reference management. Bytecode owns the new Atom references through its existing transaction/cleanup path; functions without static names allocate no map.
静态名称指令此前每次执行都取字符串并重新 intern。现在发布时链接一次,普通调用和恢复执行的帧按常量索引复用 Atom。保留字符串常量、序列化形式和现有 PropertyKey 引用管理;由字节码的现有事务与清理路径持有/释放 Atom,无静态名称的函数不分配映射。
Related issue / 关联 issue: #7
实测 / Measurements
Same release flags/machine, diagnostics off, five alternating before/after repetitions; all 40 runs passed output checks. / 同一机器和 release 参数、关闭诊断,五轮交替对照,40 次运行输出校验全部通过。
Original Richards median score: 16.7 → 24.1 (+44.31%). Whole-process times include initialization/compilation/teardown and are distinct from harness scores. Empty-loop control ranges overlap; no numeric-loop improvement is claimed.
原始 Richards 中位分数 16.7 → 24.1(+44.31%)。完整进程耗时包含初始化、编译和收尾,与 harness 分数是不同指标;空循环对照范围重叠,不据此声称数值循环优化。
Compile/publication medians: property reads 0.094 → 0.101 ms, original Richards 12.697 → 12.586 ms. Original Richards retains 6,912 map bytes + 5,824 auxiliary-reference bytes, excluding allocator/Rc headers, Atom-table/string storage and VM-frame changes; live table-backed Atoms increase 471 → 518 in the compilation snapshot. These are measured costs, not total memory overhead or a general speedup guarantee.
编译加发布中位时间:属性读取 0.094 → 0.101 ms,原始 Richards 12.697 → 12.586 ms。原始 Richards 新增 6,912 字节映射 + 5,824 字节引用数组载荷,不含 allocator/Rc 头、Atom 表/字符串和 VM 帧变化;编译快照中的表内 Atom 471 → 518。这不是总内存增量,也不是普遍收益保证。
双语报告 / Report · 全部样本、哈希及对照 / Samples, hashes and comparison
验证 / Validation