perf(vm): bypass runtime coercion for primitive operands - #13
Open
Eric-Song-Nop wants to merge 3 commits into
Open
perf(vm): bypass runtime coercion for primitive operands#13Eric-Song-Nop wants to merge 3 commits into
Eric-Song-Nop wants to merge 3 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 #12. Base:
perf/static-property-atoms; head:perf/primitive-coercion-fast-path, both inpocket-stack/quickjs-oxide. Review and merge in dependency order.Migrated from Eric-Song-Nop#3 with identical commits and preserved measurement/validation evidence.
Change / 修改
Arithmetic and comparison instructions used to send primitive operands through VmHost into Runtime::to_primitive before receiving the same value back. Add one inline VM ToPrimitive entry point: return primitives unchanged and delegate objects, with the original hint, to the existing host. Numeric preparation and unary/add/comparison instructions share that entry point; arithmetic, result tagging, string/BigInt handling and object conversion remain single implementations.
数值与比较指令此前把原始值送入 VmHost/Runtime 后再原样返回。现在通过一个共享 VM ToPrimitive 入口直接返回原始值,对象及原 hint 交给现有 host。数值准备与一元/加法/比较复用入口,计算、结果标签、字符串/BigInt 与对象转换规则保持单一实现。
Related issue / 关联 issue: #8
Validation / 验证
Measurements / 测量
Same PocketLab machine and release flags, runtime diagnostics inactive, unchanged workloads. All 80 runs passed output checks: five alternating pairs for each initial workload plus a separate ten-pair confirmation for each Richards workload, using the exact same binaries. All initial and confirmation samples are retained.
同机同 release 配置、运行时诊断关闭、工作负载未改动。首轮每负载五轮交替对照,随后对两种 Richards 分别独立复测十轮,使用哈希相同的二进制。80 次输出全部校验通过,保留两轮全部样本。
Richards ranges overlap in both rounds; no stable Richards gain is established, and a small regression remains possible. Property-read timing includes numeric loop/accumulation work. CPU frequency/system isolation were not controlled; this is not a whole-engine speedup claim. No new CPU sampling or phase/memory probe was performed.
Richards 两轮范围均重叠,没有建立稳定收益,小幅回退仍有可能。属性读取负载包含数值循环和累加;未锁频或完全隔离系统,不把单个负载收益推广到整个引擎。本轮未重新采集 CPU 栈或阶段/内存探针。
双语报告 / Report · 全部样本及验证记录 / Samples and receipts