Skip to content

perf(vm): reuse linked Atoms for static property names - #12

Open
Eric-Song-Nop wants to merge 5 commits into
perf/array-own-key-early-checkfrom
perf/static-property-atoms
Open

perf(vm): reuse linked Atoms for static property names#12
Eric-Song-Nop wants to merge 5 commits into
perf/array-own-key-early-checkfrom
perf/static-property-atoms

Conversation

@Eric-Song-Nop

Copy link
Copy Markdown

Stacked on #11. Base: perf/array-own-key-early-check; head: perf/static-property-atoms, both in pocket-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 次运行输出校验全部通过。

Workload / 工作量 Before median ms After median ms Time reduction / 耗时下降
Fixed property reads ×20 million / 属性读取 2,000 万次 10813.374 7240.065 33.05%
Fixed Richards ×10 / 固定 Richards 十次 2117.465 1477.229 30.24%
Original Richards harness / 原始 harness 8460.681 6163.680 27.15%

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

  • 2,998 Rust tests passed, 0 failed, one existing ignored; ownership/rollback, runtime isolation, numeric/UTF-16 keys, getter/Proxy/prototype behavior, resumed generators and malformed mappings covered. / 2998 项通过,零失败,1 项原有忽略,覆盖上述语义及生命周期。
  • All 102,037 Test262 outcome rows match the parent revision, zero changed rows/new failures. The frozen full-file receipt still fails because the source fingerprint changes the header; no baseline updated. / 完整 Test262 前后逐行一致;冻结完整文件校验仍因源码指纹变化失败,没有更新基线。
  • Formatting, source layout, Rust-only and strict production Clippy passed (Rust 1.88; profiling, default and test262-host configurations). / 格式、布局、Rust-only 和三种配置的生产目标 strict Clippy 通过。
  • Binary-object production boundary passed remotely; all 690 isolation canaries were rejected. / 远端字节码生产边界检查通过,690 个隔离 canary 全部被拒绝。
  • All 480 compilation-probe iterations retained, with 432 non-warmup samples. CPU stacks were not re-sampled in this round. / 保留全部 480 个编译探针迭代,其中 432 个非 warmup;本轮未重新采集 CPU 栈。

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