Repository navigation
perf(octane): share signal graph flags directly - #2097
Conversation
Benchmark report
Compares js-framework: 1k/10k row operations
All 20 timed operations (19 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
75 other measured values are unchanged. Public-import reachability bundles (bytes)
112 other measured values are unchanged. |
trueadm
left a comment
There was a problem hiding this comment.
Approving. Moving the flag masks into a graph-free leaf removes the GraphBridge.flags dictionary and its property reads without changing the bit layout. It also measurably shrinks the signal bundles.
Correctness. The values move unchanged from signals/graph.ts into signals/graph-flags.ts, so the graph still owns the bit layout through a single module. pending.ts now imports only the four masks it needs (DIRTY | PENDING in installable, DIRTY and then MUTABLE | WATCHING in promoteSlots). The leaf imports nothing, so transition promotion doesn't pull the graph into renderer-only paths. I found no remaining graph.flags reader anywhere in packages/.
Tests. The extended bundle-boundaries.test.mjs case now covers both module load orders (graph first and renderer first) for both placements. The added count.set(3) assertion checks that a node promoted with MUTABLE | WATCHING still propagates afterwards. That's the property that would break if a mask were wrong, and your mutation check on the dirty bit confirms the test catches it.
Numbers (benchmark on dab91b5, run 38756231425):
- All 64 work counters are unchanged.
wayfinder_jsis −176 raw / −93 gzip.- JSX
shell_jsis −174 / −98, andshell_client_jsis −174 / −110. - Reachability:
hydrate-frame−171 / −130,split-shell−172 / −91,split-shell-signals−172 / −93 (−0.4%). - The only increases are
shell_app_gzip+1,shell_client_app_gzip+4 andsplit-shell-runtimegzip +1. These are compression jitter on unchanged app code. - One timing verdict is flagged: JSX
replace−17.2% faster. I wouldn't credit this change with it, since it doesn't touch the keyed-list path, so please don't cite it as a win.
CI on the current head is fully green: 30 pass, 6 skipped matrix placeholders.
Reviewed with Claude Code
Summary
Move the signal graph's seven bit masks into a graph-free constants module and let transition promotion import the four it uses directly. This removes the runtime
GraphBridge.flagsdictionary while preserving synchronous graph/renderer registration and the full bit layout's single owner.Validation
pnpm format:check(scoped format check passed)pnpm typecheck(scoped typecheck passed)pnpm test(full workspace suite not run locally)Risk / follow-ups
The complete-client measurement is one checked-in consumer and one toolchain. The summed independently compressed assets reflect the build's separate delivery artifacts. Current-head CI provides broader coverage.
Provenance
agent-authored)Codex task · host
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need.Note
Low Risk
Refactor of constant wiring and bridge surface only; reactive semantics unchanged, with expanded bundle-boundary tests covering load order and transition promotion.
Overview
Moves reactive graph bitmasks into a graph-free
graph-flagsmodule so transition promotion can importREACTIVE_DIRTY,REACTIVE_PENDING,REACTIVE_MUTABLE, andREACTIVE_WATCHINGdirectly instead of reading them from the runtimeGraphBridge.flagstable.graph.tsnow sources all seven flags from that leaf;registerGraphBridgeno longer exposes aflagsdictionary, and theGraphBridgetype intransition-state.tsdrops theflagsfield accordingly. Behavior and bit layout stay the same—this is a bundle-size / indirection cleanup for renderer-islands paths that loadpending.tswithout pulling flag plumbing through the bridge.The bundle-boundaries late-signal Action fixture is async and parameterized by
graphFirstso both module load orders (renderer vs graph first) are exercised under default andoctane-islandsplacement, with extra post-release write/subscribe checks. A patch changeset documents the octane bundle overhead reduction.Reviewed by Cursor Bugbot for commit dab91b5. Bugbot is set up for automated code reviews on this repo. Configure here.