Repository navigation
perf: avoid host child rest-array forwarding - #1025
Merged
domgan-oai merged 1 commit intoSep 9, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
domgan-oai
marked this pull request as ready for review
September 9, 2026 20:40
Closed
68 of 84 tasks
14 of 21 tasks
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.
Summary
ComponentBodyarguments directly through the stablehostComponentchild body, preserving its latest target and return value without a rest array.Why
Issue #981 identifies per-render rest/spread allocation in the host-child trampoline. The body ABI supplies exactly three arguments; a host adapter such as
motion.divcan forward them directly.Validation
pnpm format:check— scoped formatting passed locally; the CI lint checks passed.pnpm typecheck— the local run reached its final command without diagnostics, but a shell wrapper masked its exit code; the CI typecheck passed.pnpm test— focused tests passed locally; all current-head CI test shards passed.pnpm typecheck:files packages/octane/src/runtime.ts packages/octane/tests/host-component-props.test.ts packages/octane/tests/_fixtures/host-component-children.tsrxpnpm format:files:checkon all changed source, tests, benchmark files, and changeset.node benchmarks/host-component/work.mjs: semantic controls and work counts pass.pnpm sync: no generated changes.Performance audit
In the same production esbuild + Chromium 149 jitless observer on Node 26.4, rest-parameter executions fall from 128/1,024 to 0 per mount or update with 128/1,024 callable-child hosts, and from 1,536/12,288 to 0 across twelve updates. Host and child call counts, output, DOM identity, nesting, and teardown match; equivalent descriptor-child controls remain at zero. The unminified observer bundle grows 26 bytes. These are deterministic source/interpreter work counts, not a throughput claim.
Risk / follow-ups
The wrapper's receiver, latest child target, three positional arguments, and return value remain intact. A separate baseline root-unmount ref cleanup behavior in this host path was observed during test development; removal/ref cleanup and root-unmount effect cleanup are covered here. The remaining per-render allocation examples in #981 stay open.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches the hot
hostComponentchild-reconciliation path in core runtime, though the ABI is unchanged and tests/benchmarks target reconciliation and forwarding semantics.Overview
Removes per-render rest-argument array allocation in reused host components (e.g.
motion.<tag>) by changing the stable child delegator inhostComponentfrom(...args) => latest(...args)to explicit(props, scope, extra) => latest!(props, scope, extra), while still updatingstate.latesteach render sochildSlotkeeps a stable body identity.Adds regression coverage for callable children (returned renderables) and compiled host children (props updates, preserved state/DOM,
@ifremoval, ref/effect cleanup, remounts), plus a production benchmark that bundles the real runtime, asserts semantics/DOM identity, and gates on zero rest parameters in the emitted trampoline (with optional--measurefor baseline comparison).Reviewed by Cursor Bugbot for commit 3c46b07. Bugbot is set up for automated code reviews on this repo. Configure here.