Repository navigation
perf: compact delegated handler bundle literals - #991
Merged
domgan-oai merged 1 commit intoSep 8, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 8, 2026 12:14
Closed
68 of 84 tasks
This was referenced Sep 8, 2026
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
Why
The earlier Symbol-first literal prevents V8 from building
fnandargsinto its object-literal boilerplate. Each event-enabled compiled row typically mounts two bundles. On currentmain, the exact productionevt1output uses three keyed property definitions and retains a 56-byte bundle; the reordered literal uses two named definitions plus the Symbol and retains a 48-byte bundle.Changes
HandlerBundleliterals and document why the computed brand is last.octanepatch changeset.Validation
evt2bundle brand is deliberately omitted in memory. The compiled event suite passed all 18 tests in bothoctaneandoctane-prodon CI.evt1V8 probe (Node 26/V8 14.6): 72 → 64 bytes of bytecode, 3 keyed definitions → 2 named plus 1 keyed, 56 → 48 bytes per fast-property bundle. Two hundred thousand retained bundles use 1.6 MB less heap. Own keys/descriptors and brand values match.git diff --check, and source-only public-event probe.pnpm synccould not start after the dependency registry returned 403 during the frozen install.Risk / follow-ups
Literal field evaluation order changes only among internal parameter reads and constants; JS own-key order and property descriptors match. Fixed-arity
argsarrays still allocate, so the separate #981 suggestion to store those arguments as fields remains open. A compiled js-framework benchmark remains useful before making a broad application-speed claim.Refs #981. Follows merged #990.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Internal literal field order only; semantics and property descriptors are unchanged, with new tests locking in sync-dispatch snapshot behavior.
Overview
Reorders delegated event
HandlerBundleobject literals sofnandargscome first and the private Symbol brand is last, inevt0–evtNand inpreserveDispatchedBundledispatch snapshots. Runtime comments explain this helps V8 use object-literal boilerplate and cuts retained bundle size (e.g. smaller per-bundle footprint at scale) without changing mount/update or dispatch behavior.Adds a compiled-event regression that clicks through capture/bubble with multi-argument handlers and a synchronous child
updateduring dispatch, asserting queued ancestors still see oldfn/args and the next click sees the new ones. Includes an octane patch changeset.Reviewed by Cursor Bugbot for commit de2ad8c. Bugbot is set up for automated code reviews on this repo. Configure here.