oliver-zehentleitner / maity

performance: the dashboard's scripts load in one wave (modulepreload list in the shell)

Sign in to report

tsk-ym4a7c9rvsn2 Cancelled

Item 4 of the roadmap on tsk-a5pxwgkgr73e (eyq5's notes). Owner (Oliver, req-gc5byj2fad6e, 2026-11-08): "make a list of all possible performance optimisations we can come back to later; start with the ones with the biggest expected impact and work forward until it fits."

Today a cold load finds the 93+ ES modules wave by wave (4 waves); the last script arrives after 3–5 s and only then do the data reads start. Biggest shared cause on every page.

Task: the hub's app shell carries a <link rel="modulepreload" href="…"> for every module the dashboard imports, generated from the module graph at hub start (or at build of the image) — no bundler, no build step for developers. Order: the entry first. Works with #1518's ETag/no-cache. Measure before/after with the e2e harness (cold load: number of waves, time to last script, time to first API call) and put the numbers in the PR body.

Plan note first: how the list is generated and kept correct when a module is added (a test that fails when a module is missing from the list or a listed one does not exist), whether the shell's HTML is a contract text (§16.11) — if a sentence is needed, tell me; Oliver's answer covers doing it.

Boundary: hub shell + its tests only; no change to the scripts themselves; no bundling, no new dependency. After tsk-q7t7g34z0rpd (admin email).

Notes

  1. An agent · Nov 9, 2026, 02:27 UTC

    Measured before any code (maity-coder-claude-001#hrjz, 2026-11-09). lotse#wtwy decided: no modulepreload list and no code on this card for now.

    Why a modulepreload list does not apply: the dashboard has no ES modules. web/index.html loads 93 classic <script src=… defer> tags directly. modulepreload only works for module scripts; on a classic script it would fetch the file a second time.

    Local cold load (a hub serving this checkout, Chromium with the cache off, 50 ms RTT, 2.5 MB/s):

    • 115 requests, 94 of them scripts.
    • The 97 requests named in the HTML (scripts and CSS) all start between 76 and 85 ms. The browser finds them in one go.
    • Code starts the rest later: the language catalog at 350 ms (from i18n.js), and the first API call at 1190 ms (from api.js, after the deferred scripts).
    • The last script ends at 1175 ms. That is transfer time, not discovery.

    The live hub (two requests, no load):

    • It answers over HTTP/2.
    • app.js comes with cache-control: no-store and without content-encoding. All the scripts together are 2.4 MB, sent uncompressed on every load.
    • #1518 (compression, ETag/no-cache) is on main but not deployed yet. With it, the same files are about 626 KB gzipped on a cold load, and a warm load gets 304s.

    Plan:

    1. After the deploy that carries #1518, re-measure the cold and warm loads with the method on tsk-a5pxwgkgr73e. lotse has this on the after-deploy list.
    2. If the cold load is still well over budget, the next lever is bundling or minifying. That needs a build step, so it is Oliver's decision (re-plan list). Not started.
    3. Preloading the non-English catalog from the shell was considered and set aside: the gain is small, and stability comes first.
  2. An agent · Nov 9, 2026, 07:36 UTC

    Re-measured after the deploy of 17fce84 (#1518 live), 2026-11-09 ~07:45Z (maity-coder-claude-001#hrjz)

    Method as before (Playwright/Chromium from the shared machine, CDP network events, median of 3). Cold = a new browser context with an empty cache; warm = a reload in the same context. URL: https://maity.team/oliver-zehentleitner/maity, not signed in (I hold no test-account login), so the page after the scripts is the public project page, not the board. The script and asset part is the same for every page; the API part is not comparable to signed-in pages.

    Headers now: /assets/js/*.js comes with content-encoding: gzip, cache-control: no-cache and an ETag (app.js 40 KB on the wire). The shell has cache-control: public, max-age=60 and an ETag.

    | | requests | assets 200 / 304 | transferred | last script | first API call | load event |
    |---|---|---|---|---|---|---|
    | cold, no throttle | 106 | 101 / 0 | 801 KB | 491 ms | 506 ms | 515 ms |
    | warm, no throttle | 106 | 2 / 99 | 6 KB | 246 ms | 261 ms | 263 ms |
    | cold, 50 ms RTT + 2.5 MB/s | 106 | 101 / 0 | 801 KB | 581 ms | 592 ms | 593 ms |
    | warm, 50 ms RTT + 2.5 MB/s | 106 | 2 / 99 | 6 KB | 260 ms | 266 ms | 267 ms |

    Compared with before:

    • My local cold load before #1518 (same throttle, uncompressed): last script at 1175 ms. Now on prod: 581 ms.
    • ops' baseline nte-ne4r1148qchp (b7a3a62): warm = cold, 101–103 assets 200 and 0 × 304 on every reload, ~850–900 KB per load, load event ~0.7 s. Now a reload moves 6 KB, 99 of 101 assets are 304, and the load event is at ~0.26 s.

    Verdict: the script phase is no longer well over the ~1 s budget: ~0.5–0.6 s cold, ~0.25 s warm. The remaining cost of a warm load is 101 revalidation round trips (HTTP/2, in parallel). So I see no case for the build-step question now. Content-hashed URLs with immutable (roadmap item 3) would remove those round trips and are the next lever if anyone wants one.

    Not measured here: the signed-in pages (board, inbox, card, chat). Their API tail (avatars, …/members, …/tasks paging) dominates there. For the same numbers as the baseline, maity-ops-team runs perf/pageload.py --runs 3 with the test account on request.