Repository navigation
perf: tree-shake unused transition hook queues - #1964
Conversation
Benchmark report
Compares js-framework: 1k/10k row operations
All 20 timed operations (19 without a verdict)
Work counters (an increase fails this check):
44 other measured values are unchanged. Application bundle size (bytes)
11 other measured values are unchanged. Public-import reachability bundles (bytes)
63 other measured values are unchanged. |
|
Good to go, with two non-blocking notes.
Merge note: the conflicts with #1963, #1966, #1969 and #1970 in Verified:
|
|
Traced the stateless retention: public The published head's Base UI Oxc/esbuild source maps confirm the whole chain. The available Radix/Apollo maps are baseline artifacts, so those support the unchanged source path rather than a new published-head measurement. The size increases remain disclosed in the description. Removing form-action capability from the general descriptor path would need a separate proof that preserves arbitrary props. The two guard removals are safe optional follow-ups. I am leaving the qualified transition implementation unchanged in this feedback pass; the broader independent-binding experiments remain parked. The sibling declaration spreads are all retained in the combined validation fixture. |
…ansition-owner-conflicts # Conflicts: # packages/octane/tests/optional-driver-bundle.test.ts
…ansition-owner-conflicts
…ansition-owner-conflicts # Conflicts: # packages/octane/tests/optional-driver-bundle.test.ts
Summary
Applications without transitions still retain state/reducer transition staging and replay through ordinary hook calls. Put the six existing functions on the existing
TransitionRootDriver, installed beforerunTransitionpublishes any batch. Their implementations are unchanged. Hook setters read the live driver again after authored updaters, so an updater that starts the first async Action still stages its result correctly.Against
4cc2a1ed700318846c8d93249550122bc86e3dfa, the complete production JavaScript gzip results are:Canonical Todo, chat and weather also decrease by 585, 557 and 552 gzip bytes. Feature-retaining controls grow slightly: bindings +96 B, full framework +91 B, and the active transition-hooks fixture +73 B. There are six additional references on one existing cold driver object, with no new registry, slot field, per-render allocation, scheduling hop or wrapper function.
Broader reachability controls expose an additional tradeoff in this head: some stateless bindings retain transitions through generic framework paths, and the driver object then keeps hook helpers they never call. Base UI Separator grows by 556 B gzip with Oxc and 554 B with direct esbuild; Radix Separator by 536/547 B; ApolloProvider/useApolloClient by 554/529 B. The attempted independent-binding refinements were parked because their follow-up measurements did not resolve a potential small active-path performance cost. They are not included in this PR; the current published head retains the original implementation and the size tradeoffs above.
Validation
Signed
c13f79735integrates main64c33de2f; GitHub reports it mergeable and current-head CI passes. The final integration passes 32 focused dev/prod executions, formatting and sync, with unchanged production hashes during validation and independent source review. The earlier performance measurements retain their stated source and limitations.pnpm format:check— current-head CI passes; changed-file check also passes locally.pnpm typecheck— current-head CI passes; scoped runtime and changed test programs also pass locally.pnpm test— current-head full CI passes.check-staged-dom,perf-review-scanand independent source/complexity review pass.concise-code: reuse the existing driver and remove redundant reducer/deferred absence checks; six separate global function bindings were unnecessary. All six implementation bodies and hot record shapes remain unchanged.pnpm syncpasses and generates no additional diff.The timing estimate is the median head/base ratio of group arithmetic means, with a paired-bootstrap 95% interval. No slowdown was detected in the four warmed synchronous operations; the largest upper bound is +1.17%. Identical-code controls overlap parity. This does not establish a speedup.
The local environment uses Node 24.20.0, Vite 8.1.5, esbuild 0.28.1 and Chromium 149.0.7827.55. Canonical bytes use the repository's Oxc/framework-split settings; ordinary work and the owning browser timings use production esbuild without framework splitting. The creation census is separately identified as its existing unminified production observer, not the timed browser artifact.
Risk / follow-ups
Active consumers and the stateless binding controls above pay the disclosed size increases; all access the same implementations through the existing driver. The targeted timings measure complete synchronous public-root hook operations; they do not establish application latency, first-activation cost, or universal/tail equivalence. Current-head CI is green and the benchmark report agrees with the local rows sizes. The experimental stateless-binding refinements are parked; this published implementation is unchanged and maintainer review is still required.
Provenance
agent-authored)Codex task · implementation host
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Refactors hot paths in state, reducer, linked state, and deferred updates; behavior is intended to be unchanged but transition/Action edge cases are sensitive.
Overview
Routes transition hook staging and replay (
stagedTransitionValue,stageTransitionValue,readQueuedTransition, and related helpers) throughTransitionRootDriverinstead of calling them directly fromuseState,useReducer,useLinkedState, and deferred-value scheduling.Apps that never install the transition driver can tree-shake those six implementations; when the driver is absent, setters fall back to ordinary slot values and skip transition queuing. Staging still runs after functional updaters execute, so an updater that calls
startTransitionfor the first time can install the driver and queue the update correctly.Bundle tests now treat those declarations as optional and add state/linked-state coverage for async transitions started inside an updater.
Reviewed by Cursor Bugbot for commit 8d116f2. Bugbot is set up for automated code reviews on this repo. Configure here.