SPB Git

Repository Public

PERF-web.md 5.5 KB 84 lines markdown

1# SP Drive 2.0 — web performance, before and after23Measured on the node (m5ma, Apple M5 Pro) on 2026-11-19. "Before" is commit `ace03c1` (branch `next` before the web4work, i.e. the 1.0 interface on the 2.0 API), built in a separate worktree; "after" is the head of `next`.56## Method (the same for both)78- `pnpm build` in each checkout; sizes are the files Vite wrote to `dist/web/assets` (raw, and gzip of each file).9- `scripts/perf-web.sh <checkout> <label> <port>` starts **that checkout's API** on a scratch database with **its built10  bundle** (not the Vite dev server), creates an account with a virtual passkey, seeds it (3 folders and 12 files at11  the root; a folder with **2,000 files**: 100 uploads, then copied in place 19 times), and runs12  `scripts/perf-web.mjs` with headless Chromium (Playwright 1.65), viewport 1440 × 900, localhost.13- Each figure is the **median** of 9 loads (explorer root) or 5 loads (2,000-file folder). Every load starts from another14  document, with a warm HTTP cache.15  - *first row*: `performance.now()` (from navigation start) when the first row of the listing is in the DOM, taken by16    a `MutationObserver` installed before any script of the page.17  - *long tasks*: sum of the `longtask` entries (> 50 ms) from navigation start to network idle.18  - *DOM nodes*, *rows rendered*: counted after network idle.19  - *select*: from a click on the first row to the frame that paints it selected.20- *transfer*: script and style the explorer route downloads on a cold cache (`performance.getEntriesByType('resource')`).21  The API serves files uncompressed; the reverse proxy compresses in production, hence the gzip column of the bundle table.2223Run it again: `pnpm build && zsh scripts/perf-web.sh "$PWD" after 8672` (and the same on a worktree of the commit to compare).2425## Results2627### Explorer and the 2,000-file folder2829| | before | after |30|---|---|---|31| Explorer root (3 folders, 12 files) — first row | 331 ms | 334 ms |32| — long tasks | 0 ms | 0 ms |33| — DOM nodes | 442 | 486 |34| — select a row | 29 ms | 32 ms |35| 2,000 files, list — first row | 466 ms | **373 ms** |36| — rows rendered at first | 2,000 | **240** (the rest as the end of the list comes into view) |37| — DOM nodes | 38,202 | **4,787** |38| — long tasks | 1,320 ms | **0 ms** |39| — select a row | 55 ms | **30 ms** |40| 2,000 files, grid — first row | 413 ms | **367 ms** |41| — DOM nodes | 34,193 | **4,778** |42| — long tasks | 990 ms | **0 ms** |43| — select a row | 45 ms | **30 ms** |44| Explorer route, cold cache: script + style | 17 requests, 667 kB | 28 requests, 795 kB |4546What changed for large folders: the listing renders 240 rows, then 240 more each time a sentinel 800 px before the end47enters the viewport (`IntersectionObserver`); keyboard navigation to a row not rendered yet (End, Shift+End) renders48the whole list first, select-all works on the data, not on the DOM. The 1.0 `content-visibility: auto` on list rows is49kept. The staggered entrance of 1.0 (a per-child animation) is gone: one `navigate` motion on the container.5051The route is heavier by 128 kB uncompressed (11 more small requests): the shell now carries live refresh, the52transfer centre and the 2.0 dictionary (two languages, ≈ 45 kB), and the explorer the inspector. First row at the53root did not move (331 → 334 ms, within noise).5455### Bundle, per chunk (kB raw / kB gzip)5657| chunk | before | after | note |58|---|---|---|---|59| `index` (entry: router, i18n, react-query) | 263.0 / 82.6 | 242.4 / 76.4 | a new shared chunk `useBaseQuery` (23.1 / 7.7) appeared beside it |60| `ui` (React DOM + building blocks) | 141.4 / 43.8 | 191.8 / 58.2 | the bundler groups shared modules differently now that more lazy screens import them (not analysed module by module) |61| `Explorer` | 73.4 / 21.3 | 65.0 / 18.4 | the viewer left it (below) |62| `Viewer` (lazy with the explorer) | in `Explorer` + `Thumb` (31.9 / 10.4) | 29.7 / 9.7 + `Thumb` 2.7 / 1.4 | |63| `Shell` | 24.4 / 7.9 | 24.5 / 7.8 | palette is now lazy (7.9 / 3.2) |64| `UploadPanel` (transfer centre) | in `Explorer` | 21.4 / 7.1 | loaded with the shell |65| `PdfView` (pdf.js, lazy) | 477.6 / 143.4 | 477.8 / 143.5 | unchanged; also used on demand by the PDF version comparison |66| `MarkdownView` (lazy) | 80.8 / 27.5 | 80.8 / 27.5 | |67| `Settings` / `Admin` (lazy) | 17.4 / 4.8 · 13.9 / 3.9 | 20.9 / 5.8 · 21.7 / 5.9 | devices, AI switch, infrastructure |68| `RequestDialog` (lazy) | 15.5 / 4.9 | 22.0 / 6.4 | live preview |69| new lazy screens | — | `Storage` 15.4 / 4.8 · `TimeMachine` 14.3 / 5.0 · `Ask` 13.9 / 5.2 · `Collections` 13.8 / 4.4 · `Shared` 13.7 / 4.2 · `Activity` 7.5 / 2.7 · `Members` 7.0 / 2.6 · `Suggest` 5.2 / 2.1 | each loads on first use |70| CSS (`index`) | 67.5 / 13.7 | 82.1 / 16.6 | token layer (3 themes × contrast), new utilities |71| **all script** (30 → 48 files, pdf worker excluded) | 1,283 / 400 | 1,482 / 466 | +199 kB raw for every 2.0 screen |72| **all style** | 72.8 / 14.9 | 87.3 / 17.7 | |7374No dependency was added: the charts (treemap, bars, rings), the line diff, the SSE reader and the view-transition75morph are written in the application (`next/Storage.tsx`, `next/diff.ts`, `next/ai/stream.ts`, `explorer/Explorer.tsx`).76Heavy views stay lazy: pdf.js, the Markdown pipeline, every 2.0 screen, the palette, the time machine, the member and77suggestion dialogs.7879### Motion8081Animations use `transform` and `opacity` only (progress bars are scaled, rings animate a stroke offset), so they run82on the compositor; no frame-rate trace was recorded in this delivery — the long-task figures above are the only83measured smoothness indicator.84
Files main
Menu

Theme