Skip to content

[lynx-perf 7] Receiver diet: shrink the MT slice, spend it on FCP #8

Closed as not planned

Description

@Huxpro

Independent; best after [lynx-perf 5]/[lynx-perf 6] (they delete code this issue then ships less of).

The measured problem

The lynx bundle for the reference table app is ~102.8KB gzip; octane's own baselines split a same-scale app at ~59KB MT / ~51KB BG. The MT slice — receiver, per-command staging/validation, ack machinery, worklet bridge, one-shot renderer — outweighs an entire vue vdom app (40.7KB all-in) and must be evaluated before first paint. FCP@10k ≈ 1090ms vs vue band 795–949 vs ReactLynx 459 (32KB all-in, code-staged first frame — that tier is structural; the vue band is the target).

Change

  1. Make MT modules define-shakable: dev-only validation ([lynx-perf 5]), handle machinery leftovers ([lynx-perf 6]), diagnostics/self-audit strings, first-screen-only code releasable after adoption completes.
  2. Lazy-init the worklet bridge (~1.8k lines): load/register on first 'main thread' usage; apps without worklets pay zero. Assert with a string probe on a no-worklet app's bundle.
  3. Unify the one-shot renderer's plan materialization with the receiver's ([lynx-perf 4] unified them semantically — unify the bytes).
  4. Add gzip-per-slice to the rig's deterministic gates (the .web.bundle sections are ground truth).

Constraints

  • No behavior changes; every removal is a define or a lazy boundary with a test.
  • Bundle-shape gates in benchmarks/baselines/ratios.json updated with justifications, not deleted.

Acceptance (rig)

  • MT slice gzip −25% or better (~59KB → ≤45KB); whole rig-app bundle ≤80KB.
  • FCP@10k lands in the ~800–900ms band on the rig host; FCP slope (α) unchanged.

Activity

  1. Huxpro commented on Aug 9, 2026

    @Huxpro
    OwnerAuthor

    Measured outcome, shipped as PR #15 (stacked on #14).

    What shipped

    • Lazy worklet bridge (item 2): the receiver now reaches the worklet registry only through a side-effect-free bridge slot (core/worklet-bridge.ts), provided by main-renderer.ts's thread-function entry points. A no-worklet main-thread bundle sheds the entire registry/call-bridge machinery; worklet traffic arriving anyway reports cleanly. Both directions are pinned by esbuild tree-shaking probes and behavioral no-bridge tests.
    • Per-slice gzip gates (item 4): frozen slice-budget-preview/slice-budget-ifr reference targets in lynx-bundle-size, four new ratio guards (preview-main, IFR-main, background, whole-bundle; 1.03× headroom). Red-checked: breaking the bridge boundary breaches both main-slice budgets by +2.3 KB.

    Measured (tasm decode + gzip -9, medians, baseline = #14 head):

    slice before after Δ
    rig app main-thread 70,384 67,828 −2,556 (−3.6%)
    rig app background 64,119 64,119 byte-identical
    fixture preview main 64,266 61,893 −2,373
    fixture IFR main 68,570 65,942 −2,628

    Items resolved by measurement instead of code

    • Diagnostics-string diet (item 1): rejected with data. The prod MT slice carries 69 diagnostic strings, 10,153 raw bytes — but stripping all of them moves the slice only −234 bytes gzip (repetitive prose is nearly free under gzip, and gzip is the gate metric). The self-audit path was already dev-folded by [lynx-perf 5]; the prod slice contains zero validate/selfCheck occurrences.
    • Plan-materialization unification (item 3): assessed, not forced. renderPlanNode is a live renderer (components, control flow, slots, suspense, context); plan-wire.ts's expansion is a static command stamper. Shared surface is a few dozen lines of prop/text canonicalization — well under 1 KB gzip for real first-screen regression risk. Not a good trade under the no-behavior-change constraint.

    Acceptance, honestly

    • MT gzip −25% (→ ≤45 KB): not met — measured −3.6%. The projection was made on unminified module shares; production usedExports DCE had already dropped most of the projected mass, and [lynx-perf 5/6] had already dev-folded validation/handles. The two remaining projected levers measure at −234 B and <1 KB.
    • Whole bundle ≤80 KB: not met (128.8 KB fixture IFR; the ~102.8 KB anchor predates the stack's features and toolchain). Both slices now sit under frozen budget gates so growth is a red build.
    • FCP@10k: no resolvable delta — interleaved A/B on the same host window (baseline medians 4,390/4,075/4,013 ms vs after 4,128/4,109/4,945 ms) is inside ±900 ms host noise; the ~800–900 ms band belongs to the pre-migration host. Slope unchanged by construction (no per-row work touched).
    • Every removal is a lazy boundary with a test: met. Gates updated with justifications, not deleted: met.

    Generated by Claude Code

  2. Huxpro commented on Aug 11, 2026

    @Huxpro
    OwnerAuthor

    Live-main audit (2026-08-11): exact bridge patch rejected; successor is #44. A live-main reimplementation recovered about 1–3% gzip but regressed expanded reverse selectStorm@10k by 20.2%. #44 keeps the no-worklet cold-feature goal while requiring a compiler/capability-owned split and forward/reverse runtime gates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions