Repository navigation
perf: omit unused capture completion code - #1976
Conversation
…pture-owner-bundle
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
10 other measured values are unchanged. Public-import reachability bundles (bytes)
36 other measured values are unchanged. |
…pture-owner-bundle # Conflicts: # packages/octane/tests/optional-driver-bundle.test.ts
|
The code at this head is correct, but it needs a rebase with one runtime change before it can land. The only
Please add a compiled Nit: Verified:
|
…pture-owner-bundle # Conflicts: # packages/octane/src/runtime.ts
…pture-owner-bundle # Conflicts: # packages/octane/tests/optional-driver-bundle.test.ts
Summary
Applications without authored capture handlers retain capture completion work through the native capture observer. Install the existing completion target when capture handlers register, so these bundles can omit the finisher. The dispatcher and two-argument finisher bodies, call position, listener order and controlled-input restoration stay intact.
The runtime change is one local target, an assignment in the shared capture-registration function before capture flag/map publication, and the existing call's callee. Both public and compiler-private registration install the same target. A fresh production test adds capture to a live bubble-only root and verifies repeated stopped-input restoration, focus, DOM identity and teardown. Source-map assertions check absence and retention of the finisher body.
Historical complete production JavaScript gzip, exact fixed
4cc2a1→ the qualified implementation before main’s ref/clone/static-event integrations:Oxc uses the canonical framework split; ordinary esbuild uses the original fixture configuration without a split. These are whole-JavaScript totals, not a minifier-only comparison.
Current integration validation
Signed merge
af9530155incorporates main8c09d8152and resolves the overlapping optional-driver bundle tests while preserving both parents' implementations, complete fixtures, and assertions. The merged source passes 130 focused test executions, the scoped runtime typecheck, formatting, andpnpm sync. Independent source and validation reviews pass. All 30 checks pass on this exact head, and GitHub reports it mergeable; reviewer approval remains required.The current CI benchmark reports all 64 work counters unchanged. Complete Oxc rows JavaScript gzip changes from 29,587 → 29,503 B for TSRX and 54,147 → 54,160 B for JSX; the bindings fixture grows by 14 B gzip, with other retained-feature tradeoffs listed in the report. No timing interval has a strictly positive lower bound in this run, which does not establish equivalence. The uploaded artifact contains summary intervals but no raw timing pairs or emitted JavaScript/maps; historical performance limitations below remain open.
Earlier measurements and integration results below apply to their named revisions.
Validation
Signed head
7c0cb3304integrates main64c33de2fand passes 30 focused optional-feature/event-registration executions across dev/prod, formatting and sync. All 255 production hashes stayed unchanged during validation. Independent review confirms the incoming main code and both parents' tests are preserved; the capture finisher and dispatcher bodies remain unchanged. CI passed on historical signed7c0cb3304. The earlier browser, type, byte and timing receipts below remain tied to their named pre-integration source.pnpm format:check— repo-wide check not run; scoped changed-file check passes.pnpm typecheck— repo-wide check not run; runtime and changed-test checks pass with zero diagnostics.pnpm test— full workspace sweep not run.targeted tests: 88 candidate development/production executions across eight owning files; the new public restoration case also passes twice on the baseline.
No-op and omitted installers each fail both public restoration assertions; eager installation fails both body-absence assertions. Source restored exactly after each control.
Staged-DOM and performance scans, scoped formatting, and fresh production browser controls pass. All 12 baseline/candidate fault and trusted-input observations agree; a no-op finisher preserves capture delivery but fails the unchanged value/selection restoration oracle.
All 64 original ordinary call/DOM counters are equal, including original styles and direct-list gates. Complete owning flows are also equal: 36,355 normal-capture calls and 34,819 pre-try-error calls per side, with matching semantics/DOM and four zero-call quiet checks. Named diagnostics verify actual finisher execution and a genuinely dormant prefix.
perf-review: the original scan reports zero candidates. Capture registration installs one stable target before publishing its flag; dispatch changes only the finisher callee. No new record fields, per-event allocations/calls, DOM work or scheduling are added. The source/work/timing receipts below qualify the original implementation; later CI performance observations remain open as described below.concise-code: runtime +4/−1 lines, no new exports/modules/hot-record fields; one existing test file and a release changeset. Keeping the direct reference retains the finisher; moving the whole capture body requires more machinery and was rejected after measured regressions. This smaller change keeps the original bodies and call placement. Byte benefits and retained-feature growth are reported above.The original implementation’s Chromium timing uses the unchanged public stimulus after 1,000 bubble-only events, with 16 fresh browser groups per actual/identical cohort and operation, 10 warmup plus 12 retained pairs. All 64 groups and 1,408 paired windows are retained; no exclusions or retuning. Head/base ratios and nominal 95% intervals:
No slowdown was detected in the actual primary or order partitions. These finite bounds allow +2.27% normal steady cost and +0.97% exceptional steady cost; they do not establish universal parity. The identical exception control has positive candidate-first creation/execution partitions, and identical capture has a negative candidate-first creation partition. No control bias is subtracted.
First-use precision is coarse: capture spans 0.090–0.205 ms baseline / 0.090–0.250 ms head, paired median delta −0.0075 ms, seven of 16 slower. Exception spans 0.335–0.620 / 0.310–0.575 ms, paired median delta +0.010 ms, nine of 16 slower. The 5 µs clock does not dismiss these observations; first-use upper bounds are +27.78% and +5.88%, not startup guarantees. Calibration met 20 ms on both sides; capture batches later warmed to medians 13.610/13.775 ms without changing repeats. All calibration observations remain preserved.
Risk / follow-ups
The subsequent CI benchmark run 38049355295 on
76f8f1000reports five positive nominal 95% timing intervals despite green checks: TSRX select +1.4% [+0.5%, +2.1%], swap +1.1% [+0.6%, +1.6%], clear +4.0% [+0.5%, +10.6%]; JSX select +1.2% [+0.6%, +2.2%], swap +2.1% [+0.6%, +3.6%]. All 64 deterministic work/DOM counters match. The uploaded report lacks emitted JavaScript and raw sample vectors. These observations remain unexplained; the earlier owning timings do not establish parity for these row operations. Performance acceptance remains open.Main
2075c0e72integration preserves the ref/clone changes and moves finisher installation intoregisterDelegatedCapture, so static compiled and public dynamic capture registrations both activate it. Signed headf885ceccfpasses 64 focused development/production checks, scoped runtime/test typechecking with zero diagnostics, formatting and sync. The five-page Chromium integration passes four trusted-input controls and verifies a meaningful no-op-finisher restoration failure. Independent review verifies all 255 committed production files, 520 build inputs and 18 artifacts; no new latency measurement was taken. CI passed on historical signed7c0cb3304.The existing React-comparison browser suite is unavailable locally because exact pinned
@tsrx/[email protected]is absent; no registry bypass or version substitute was used. The product diff does not edit that suite. Current-head CI remains a separate completion gate.A separate composition with the seven prior changes measures 29,020 B canonical Oxc gzip (−98 B versus that combination). Its installer is at the shared capture publisher, covering the compiler helper as well as public registration; all four trusted-input positives and a causal no-op restoration control pass. This is a bytes/producer-integration receipt, not full joint correctness, work or latency qualification. No prior held capture-body experiment is used as validation here.
Independent final source, correctness and timing audits passed. Signed implementation
62d90a1e1is preserved by signed merge76f8f1000, which incorporates only required live base5d6d02c8to satisfy strict branch currency. Post-merge sync/format and 20 focused executions pass (six new host-diagnostic cases and 14 repeated finisher cases). Only the DEV host-property diagnostic source changed: all 10 minified product/timed JavaScript assets rebuild byte-identically. The never-timed named diagnostic differs only in 26 source-path region comments; its initial strict byte-guard failure is preserved. Qualified timings were not rerun. CI passed on historical signed7c0cb3304; the earlier integration receipts above remain historical.Provenance
agent-authored)Origin: Codex task, implementation subtask
retention_audit, hostcom-79386. Key choices: fixed baseline; original bodies and call positions; one producer-installed target; meaningful restoration and retention negatives; complete-bundle, work and finite browser evidence with limitations stated separately.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes the delegated event completion path and controlled-input restoration timing when capture is registered late; correctness is guarded by new production bundle tests.
Overview
Production bundles that never register
onXxxCapturecan now dropfinishCaptureDispatchinstead of keeping it on every delegated dispatch path.Delegated dispatch calls a module-level
CAPTURE_FINISHhook;registerDelegatedCaptureassigns it to the existing finisher before capture flags are published, so behavior when capture is used is unchanged. Bundle tests treat the finisher like other optional runtime pieces and add a scenario that adds capture to a live bubble-only root and checks controlled-input restoration afterstopPropagation.Reviewed by Cursor Bugbot for commit af95301. Bugbot is set up for automated code reviews on this repo. Configure here.