Skip to content

perf(realtime): page boot as the shared runtime — islands carry thin hooks (~−50 kB on /posts/:id) #505

Description

@sebyx07

Follow-up to #504 (plan 101), written from the plan-101 bytes audit. Every island bundles its own copy of the page's realtime runtime, because islands build with `splitting: false`.

Pair on one page Shared bytes
like ∩ badge 26,444 (98% of the badge)
like ∩ boot 26,833
feed ∩ boot 26,833

Cuts, ranked

  1. Make the page boot the shared runtime. Move the store, socket client, host, channel book and outbox into the boot, and have islands reach them through the existing `Symbol.for('ultimate.realtime')` global with thin hooks. This is decision 12's "next lever" without a splitting build.
    • `/posts/:id`: about 145 kB → about 95 kB.
    • `/feed`: about 133 kB → about 98 kB.
  2. Browser error tables: only codes a browser can raise. About 5–7 kB per live island. Today `core-error-codes`, realtime `errors.ts`, `page-errors` and schema `errors` all reach island chunks.
  3. In-page socket engine only on fallback. About 5.6 kB per live island. `socket-engine` + `socket-routes` run only without a SharedWorker. Load them as a framework script by URL (the worker bundle already contains them).
  4. Seed the store from the server-rendered row. This needs a record-adopt seam and drops one GET plus about 2.2 kB from the like island.

Owners: realtime (`page-socket`, `use-*`, `boot`) and cli (`island-realtime`, `worker-bundle`). Internal only, so it can ship in a minor.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions