Verify staged lazy loading and record Phase 3 measurements

This commit is contained in:
Jonathan Sykes
2026-10-08 04:19:02 +08:00
parent fab444b7b8
commit b84050578b
12 changed files with 5462 additions and 46 deletions

View File

@@ -209,6 +209,65 @@ inspect individual responses to distinguish those from app asset downloads.
Migration results are `phase2-migration-<profile>-2026-10-07.json`.
`ASSET_SYNC=0` selects the legacy path while preserving the persistent utility
cache. `ASSET_HASHING=0` also selects legacy sync because single-tag URLs cannot
pass per-file hash checks. Current assets.json groups all block; idle loading and
lazy parsing await Phase 3. Incremental mode now caches the manifested
pass per-file hash checks. In Phase 2 all assets.json groups blocked; Phase 3 selects core plus the active
layout and warms background groups at idle. Incremental mode now caches the manifested
`piano-engine.mjs` even though it remains absent from the legacy SHELL.
## Phase 3 lazy loading and staged apply
```bash
node perf/lazy.mjs --browser all
node perf/migration.mjs --browser all --profile lossy
node perf/migration.mjs --browser all --profile unthrottled
node perf/baseline.mjs --runs 1 --browser all --profile lte --scenario all \
--out perf/results/phase3-final-2026-10-08.json \
--compare perf/results/after-phase0-2026-10-07.json
node perf/baseline.mjs --runs 1 --browser all --profile lte --scenario cold \
--frontend-commit 7bc5b4f8b50d78ece3cca5100d54a97fece2748a \
--out perf/results/phase3-phase0-initial-2026-10-08.json
ASSET_SYNC=0 node perf/baseline.mjs --runs 1 --browser all --profile lte \
--scenario offline --out perf/results/phase3-sync-rollback-2026-10-08.json
ASSET_HASHING=0 node perf/baseline.mjs --runs 1 --browser all --profile lte \
--scenario offline --out perf/results/phase3-hashing-rollback-2026-10-08.json
```
`initialJsCss` sums compressed Resource Timing bodies for page JS/CSS initiated
before DOMContentLoaded, excluding SW precache and later idle feature parsing.
The saved Phase 0 results lack that metric: `--frontend-commit` reconstructs its
frontend in scratch using the current delivery backend for a matched initial-byte
comparison. Historical boot/FCP comparisons still use `after-phase0`. Reduced
single-run measurements are directional; Phase 5 supplies repeated medians.
Update scenarios now wait for every build-N group to finish idle caching before
starting the counter, excluding unfinished initial downloads. Waiting-worker
bytes represent blocking readiness; an inactive layout's changed CSS downloads
later at idle after activation.
The browser harness checks pre-body layout selection, immediate offline reload,
four distinct Car mode controls, optional Settings search, all extension panels,
zero network for warmed first use/layout switches, contract guards and pinned
instances. Known WebKit disconnected API transport errors are recorded separately;
script errors still fail. Save-Data prevents automatic warming.
The index contains inert JSON and an external head bootstrap under unchanged
CSP. Source JSON mirrors assets.json for native/static shells; the server replaces
it with hashed build-local URLs. No boot-time manifest network request is added.
Shared layout visibility defaults remain eager in layout-base.css.
Pure EQ settings metadata and DeviceDB remain eager to preserve synchronous
player defaults and offline file bookkeeping. P2P/direct parse on actual use or
the existing eight-second sharing startup. Searching Settings explicitly loads
optional panels so their original labels remain searchable.
| JS-requested assets | Phase 3 URL treatment |
|---|---|
| opfs-worker.js, hash-worker.js, direct-recv-worker.js, p2p-recv-worker.js | Lazy.worker uses embedded per-file URL |
| Workers' sha256.js, resume-core.js, sha256-wasm.js | First postMessage carries originating build URLs; importScripts uses them |
| piano-engine.mjs | Dynamic import uses Lazy.url; incremental cache warms it |
| vendor/framework7-swipe.min.js | Ordered layout group and fallback use Lazy.url |
| loudness-wasm.js | Remains an eager stamped script; embedded binary needs no separate URL |
| fonts/fonts.css and font preloads; webmanifest/icons | Plain URLs stay aligned with CSS/manifest references; all belong to manifested cache groups |
Legacy pages cannot report their selected layout. Their one-time migration blocks
all layouts to preserve immediate offline selection; modern pages block only the
reported layout and its shared controls. Executing groups never re-evaluate live.
See plans/phase3-staged-apply-decision.md: Phase 4 must add disposal/state handoff.