Repository navigation
Conversation
Resolve the main-thread worklet registry and call bridge through a side-effect-free slot provided only by actual worklet entry points. No-worklet bundles now shed the registry and cross-thread call machinery, while worklet bundles retain the public behavior and no-worklet traffic reports a clean error. On the exact P5 parent and final P6 candidate, preview main gzip falls 64,855 to 62,420 bytes and IFR main gzip falls 69,245 to 66,685 bytes. Background raw length is unchanged; background gzip moves by one byte. Dedicated bundle-boundary tests pin both the absent and retained cases, and the deterministic bundle harness gates each slice.
This was referenced Aug 11, 2026
Owner
Author
|
Conclusion: close as failed by the live benchmark gate. The reimplemented worklet bridge regressed selectStorm; only the narrower optional-worklet cold-path hypothesis in issue 44 remains worth testing. |
This was referenced Aug 25, 2026
Open
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
worklets.ts.Why
The Lynx main-thread receiver is required by every app, but most apps do not compile a main-thread worklet. A static edge from the receiver into
worklets.tsmade those apps retain the registry, isolation, and call-bridge implementation anyway. The safe removal boundary is usage, not a flag: compiled worklet entry points provide the bridge before receiver installation, while ordinary first-screen/commit paths never edge the implementation into the final main slice.This is the independently mergeable P6 replacement for #15, refetched immediately before publication at frozen head
4a53620fe811a016cb9966fab53ca181a89159c8over source parente627ca5979ed77fbaf8ef5eafbea86c482f64cf5. The historical PR remains untouched.Changes
packages/lynx/src/core/worklet-bridge.ts: add a side-effect-free, first-provider-wins bridge slot. Its dependencies onworklets.tsare type-only.packages/lynx/src/main-renderer.ts: turn the thread-function re-exports into bridge-providing wrappers; provide beforeuseMainThreadRefcreates its descriptor; expose an explicit ensure entry point for hosts that hand-register through the lower-level module.packages/lynx/src/main-thread.ts: remove value imports fromworklets.ts, resolve the bridge once per install, null-guard registry setup/teardown and ref-owner publication, and report clean no-worklet errors for remote/host dispatches.packages/lynx/src/first-screen.ts: re-export the bridge-providingrunOn*wrappers.benchmarks/lynx-bundle-size: emit frozen preview/IFR slice targets and gate preview main, IFR main, background, and whole IFR gzip independently.@octanejs/lynxand focused public API, thread-call, main-event, compatibility, behavioral no-bridge, and real esbuild tree-shaking coverage.Stack
b41944e6effd65d3d967af9233e8cf6569ed8301)68b2b0546b28d54b7cd8d44665f95d36b58e48b3)ff7d2c71c2296b7936f17c809e46637a18963338)The fork review stack is GitHub Stack octanejs#36 and is managed with the official
gh stackextension. Upstream delivery remains bottom-to-top.Simplification and rejected levers
Performance audit
Exact comparison:
b41944e6effd65d3d967af9233e8cf6569ed830168b2b0546b28d54b7cd8d44665f95d36b58e48b3benchmarks/results/p6-parent/lynx-bundle-size.jsonin the exact-P5 worktree;benchmarks/results/p6-final-bundle/lynx-bundle-size.json,benchmarks/results/p6-final-wire-full/lynx-table.json, andbenchmarks/lynx-table/stages/results/{report.json,report.md}on P6Bundle owner signal
The main slices lose exactly the worklet edge: raw background length is unchanged, and the one-byte gzip movement there is not claimed as a regression or win. The final bundle run passes all 6 applicable guards. Red-checking a static
worklets.tsvalue edge makes the no-worklet marker probe fail and restores roughly 2.4–2.6 KB gzip to the main slices.Startup FCP and zero-DNF sanity
The exact P5 and P6 revisions were each built and run at 10k with five fresh pages for the control bundle and five for the stage-profile bundle. The harness aborts on a DNF/null FCP; all 20/20 samples completed. Runs were sequential on the same host, so the table is a regression sanity check rather than a portable speedup claim.
There is no resolvable FCP improvement. The directly observed main-slice evaluation median moves 18.9 → 17.8 ms, but total FCP is dominated by layout/Web Core publication/observer residual (about 72%) and the raw ranges overlap. The small adverse raw medians are below the run spread and are disclosed, not converted into a claim.
An additional exact-P6 one-repetition end-to-end sanity run completed create, update, select, update storm, and select storm at both 1k and 10k with zero DNFs. Its host-bound 1k values were 320/40/26/103/261 ms and 10k values were 2,684/246/114/773/3,130 ms; they are completion evidence only, not performance claims.
Deterministic protocol behavior
The final exact-HEAD 1k/10k ratio run passes all 25 applicable guards. P6 does not change transport work: create remains one command per row; update10th is 100/1,000 commands and Row renders; select is 2 commands / 237 commit bytes / 2 Row renders; swap is 997 commands / 0 Row renders; unpaced storms remain 50 update commits and 30 select commits. Paced update remains 3 commits / 300 commands over 3 frames.
Validation
4a53620fe811a016cb9966fab53ca181a89159c8pnpm typecheck— repo-wide package, typetest, example, website, and benchmark matrixspawnSync nodeEPERMs; the identical unrestricted run passed 307/307)node benchmarks/bench.mjs --ratios --results-dir=benchmarks/results/p6-final-bundle lynx-bundle-size— 6/6 guardsnode benchmarks/bench.mjs --ratios --results-dir=benchmarks/results/p6-final-wire-full lynx-table— 25/25 guardspnpm sync;git diff --check; final worktree cleanRisk / follow-ups
installLynxMainThreadwould leave that install bridge-less. Supported Lynx main-thread output is a statically evaluated slice; unsupported late traffic now fails loudly and cleanly.executeMainThreadWorkletwith no bridge owns the returned value's serializability, so that exceptional path does not run Octane's worklet isolation helper. Normal compiled worklet installs isolate exactly as before.Provenance
agent-authored)4a53620fe811a016cb9966fab53ca181a89159c8(source parente627ca5979ed77fbaf8ef5eafbea86c482f64cf5)