Skip to content
SEUNGWOO CHOI edited this page Nov 3, 2026 · 1 revision

Client performance measurement

English · 한국어

The opt-in startup/typing suite measures the production static export without adding a product benchmark route. It is separate from verify:full, API integration, and the functional offline/update checks.

Run the suite

Use a dedicated local-only build and disposable browser contexts. Leave NEXT_PUBLIC_MIROVEN_API_URL unset/empty when building; do not use a production API, an external deployment, or an existing browser profile. Install locked dependencies and Playwright Chromium, and make OpenSSL and ports 3101/3102 available. Run from web/:

npm ci
npx playwright install chromium
npm run perf
# Reuse a fresh, matching local-only export:
npm run perf:built

perf runs the normal build before perf:built; perf:built runs playwright.performance.config.ts and then tests/performance/report.mjs. A harness smoke check can reduce the sample count, but is not a publishable baseline:

$env:MIROVEN_PERF_RUNS='1'
npm run perf:built
Remove-Item Env:MIROVEN_PERF_RUNS

The default is ten samples plus one diagnostic run per scenario, with one worker and no retries. tests/performance/server.mjs wraps the uncompressed static test server in HTTPS at https://127.0.0.2:3101, proxying port 3102. It creates a one-day certificate under ignored .local/performance-tls/. Certificate exceptions apply only to this disposable test browser. This origin avoids the app's localhost Service Worker opt-out.

Method and metrics

Keep host load stable and run compared versions sequentially on the same host, without concurrent builds or browser suites. Conditions are Pixel 5 emulation, Korean locale, Chromium, 4× CPU slowdown, 1.6 Mbps download, 0.75 Mbps upload, and 150 ms latency. This is a laboratory comparison, not physical mobile or production-hosting performance.

Scenario Setup
first-visit Cold first visit with empty storage
return-100 Warm return with 100 encrypted entries and an encrypted draft
return-1000-photos Warm return with 1,000 encrypted entries, 50 tiny PNG attachments, and an encrypted draft

Each sample uses a new context. Return scenarios first load the app and complete Service Worker installation, navigate away to stop app effects, then seed synthetic data with the application's v3 encryptor. Setup is outside the timed navigation. Return navigation preserves HTTP/SW caches and IndexedDB but starts a new document without an in-memory plaintext cache. Text is roughly 900 characters per entry. The 1×1 PNGs exercise attachment presence, not realistic photo memory/decoding costs.

  • Ready time: navigation start to the first animation frame with an enabled composer. The test also verifies Save enables after typing. This excludes a person's typing time and the subsequent disk write. Draft restoration is measured separately; return input waits for that restoration.
  • Input latency: a trusted printable keydown timestamp to a double requestAnimationFrame after textarea input. It includes a paint opportunity and scheduling overhead; it is neither field INP nor a pixel-level presentation measurement. Two bursts use 35 ms key spacing with a 510 ms pause across the 500 ms autosave debounce. The second burst samples that boundary without proving every key overlaps an active disk write.
  • Long tasks and bytes: collect long tasks and JS/CSS resource timing until input settles. The server does not compress responses, so byte results do not represent gzip/Brotli hosting. npm run check:bundle separately measures uncompressed initial HTML-linked JS/CSS; Service Worker precaching can fetch lazy assets beyond that initial set.
  • Diagnostic run: the extra eleventh run records a Chromium CPU profile and is excluded from timing statistics. Return scenarios also test offline reload, journal display, and draft restoration independently of timing samples.
  • Aggregation: p50/p95 use nearest rank; input percentiles pool key samples across runs. With ten navigation samples, p95 is effectively the maximum. Retain raw values and repeat measurements before interpreting small differences.

Results and failure reporting

Ignored test-results/performance/ holds per-scenario measurements.json, separate cpu-profile.json, and aggregate summary.json. Open profiles in Chrome DevTools. Measurements contain timing, asset paths, and source/environment metadata, not vault keys or journal text. Traces, screenshots, and video are disabled; test failure messages can still show synthetic fixture text.

Record full commit SHA, working-tree changes, lockfile hash, Node/browser versions, public build settings, host constraints, and failed/skipped checks with any published comparison. Never compare a different source against stale out/. The report requires all three completed scenarios. It writes the summary and exits nonzero if an independent offline check failed, even when timing tests completed. A successful timing test count alone is insufficient. There is no built-in arbitrary timing regression threshold; agree a baseline and target before using measurements as an acceptance gate.

Historical PR #28 measurements

The following figures are the comparison reported in PR #28 for the account code split before the later Network First, full executable precache, and Worker/update refinements. They are not measurements of the final merged code or a new run performed while maintaining this Wiki.

Metric Original Account split
Initial JS/CSS 686.1 KiB 675.0 KiB
First-visit ready p50 4,564.7 ms 4,480.7 ms
Return 100 ready p50 787.2 ms 746.3 ms
Return 1,000 ready p50 953.6 ms 898.7 ms

The PR reports ten sequential samples per version/scenario, 1.84% first-visit and 5.20–5.76% return p50 improvements, and input p95 at most 33.8 ms. Return-1,000 p95 increased 1.83%, within that comparison's 10% regression limit; 20% improvement was not a required criterion. Both versions had two failing independent offline-reload checks; their report commands preserved the measurements and exited 1. Later functional regressions were verified separately, but the full performance report was not rerun for the final code. Remeasure before attributing these numbers to current PWA behavior.

Source: playwright.performance.config.ts, tests/performance, and check-bundle-budget.mjs.

Clone this wiki locally