Skip to content

perf(object): skip array-key interning for non-arrays - #11

Open
Eric-Song-Nop wants to merge 2 commits into
perf/profilorfrom
perf/array-own-key-early-check
Open

perf(object): skip array-key interning for non-arrays#11
Eric-Song-Nop wants to merge 2 commits into
perf/profilorfrom
perf/array-own-key-early-check

Conversation

@Eric-Song-Nop

Copy link
Copy Markdown

Stacked on #5. Base: perf/profilor; head: perf/array-own-key-early-check, both in pocket-stack/quickjs-oxide. Review and merge in dependency order.

Migrated from Eric-Song-Nop#1 with identical commits and preserved measurement/validation evidence.

修改 / Change

Generic property operations call array_own_key for ordinary objects too. Previously those calls interned "length" before returning Other. Check the payload first so non-arrays skip that work. End the state borrow before interning to avoid a RefCell conflict; preserve genuine Array length/index classification.

通用属性操作也会对普通对象调用 array_own_key。此前非数组在返回 Other 前会无用地 intern "length";现在先检查 payload,非数组立即返回。intern 前结束 state 借用,避免 RefCell 冲突,保留真正数组的 length/index 分类。

Related issue / 关联 issue: #6

实测 / Measurements

Same PocketLab machine, matching release build flags, diagnostics disabled, five repetitions per version/workload with alternating order. All 20 runs passed output checks. / 同一 PocketLab 机器、相同 release 参数、关闭诊断,每版本每工作负载五次交替运行,20 次输出校验全部通过。

指标 / Metric Before After Change
Fixed Richards ×10, median process ms / 固定工作量中位进程耗时 2411.234 2167.421 −10.11%
Original Richards harness, median process ms / 原 harness 中位进程耗时 9627.840 8726.416 −9.36%
Original Richards median score / 原 harness 中位分数 14.7 16.2 +10.20%

Whole-process times include startup/compilation/teardown; harness scores and fixed-workload times are separate metrics. This is one machine/workload family, not a general guarantee; CPU stacks and array-heavy performance were not remeasured. / 进程耗时包括启动、编译和收尾;harness 分数与固定工作量耗时是不同指标。这是单机单类工作负载结果,不是普遍收益保证;本次未重新采集 CPU 栈或数组密集型性能。

Report / 报告 · All samples, outputs and hashes / 全部样本、输出和哈希

验证 / Validation

  • Formatting passed / 格式检查通过。
  • Rust 1.88 engine library tests with profiling: 1,885 passed, 0 failed, including existing array/property/GC coverage. / 包含已有数组、属性及 GC 测试。
  • Rust 1.88 strict production-target Clippy (--lib --bins --features profiling): passed / 通过。
  • Initial broader all-targets strict Clippy failed on three unused imports in unchanged context/string-test source; logs retained. / 初次所有目标 strict Clippy 因未修改代码中的三处未使用导入失败,已保留日志。
  • Full Test262 was not rerun for this change. / 本次未重跑完整 Test262。

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