[spare] perf(resume): serve precompressed gzip twins of the text assets #174

Merged
cjournois merged 2 commits from perf/spare-optimize-resume into main 2026-11-16 15:46:47 +00:00
Collaborator

Why

Nothing on the resume path compresses. The nginx conf has no gzip, and the dramble security-chain has no Traefik compress middleware. Live logs show the 380 KB JS bundle going out raw, and the JS is 49% of first-load bytes. The server is idle (11 MiB of 32 MiB, about 0.6 mCPU), so transfer size is the axis worth working on.

What

  • 99be584 test: bench/first-load.ts plus a bench recipe that measures a first load through the production nginx conf. Committed before the change, as the baseline.
  • 12b0425 perf: a precompress-dist Vite plugin writes a level-9 .gz beside each text asset in dist/, only when that is smaller. nginx serves the .gz files with gzip_static on; gzip_vary on; gzip_proxied any;, so nothing is compressed per request. Fonts and images are untouched.

Numbers

12 runs per variant, interleaved, with an A-vs-A floor. Byte counts are deterministic.

Metric Base Change Δ
First-load wire bytes 772 925 432 651 −44.0%
Text bytes (no fonts) 479 997 139 723 −70.9%

The JS goes from 380 076 B to 118 634 B. Loopback latency, nginx CPU and peak memory are within noise; no millisecond win is claimed.

Check

  • just lint test is green: 190 bun tests, 14 Playwright, helm render tests.
  • A golden digest of status, content-type, Cache-Control and decoded-body sha for every first-load URL is identical before and after.
  • Headers checked in the pinned nginx image: Content-Encoding: gzip and Vary: Accept-Encoding on text responses; ETag 304s still work.

Not run: the Containerfile image build and e2e-full.

Session: 0e3485b3-1a4a-4b43-b4ba-4f6918ae6e83

## Why Nothing on the resume path compresses. The nginx conf has no `gzip`, and the dramble `security-chain` has no Traefik `compress` middleware. Live logs show the 380 KB JS bundle going out raw, and the JS is 49% of first-load bytes. The server is idle (11 MiB of 32 MiB, about 0.6 mCPU), so transfer size is the axis worth working on. ## What - `99be584` test: `bench/first-load.ts` plus a `bench` recipe that measures a first load through the production nginx conf. Committed before the change, as the baseline. - `12b0425` perf: a `precompress-dist` Vite plugin writes a level-9 `.gz` beside each text asset in `dist/`, only when that is smaller. nginx serves the `.gz` files with `gzip_static on; gzip_vary on; gzip_proxied any;`, so nothing is compressed per request. Fonts and images are untouched. ## Numbers 12 runs per variant, interleaved, with an A-vs-A floor. Byte counts are deterministic. | Metric | Base | Change | Δ | |---|---|---|---| | First-load wire bytes | 772 925 | 432 651 | −44.0% | | Text bytes (no fonts) | 479 997 | 139 723 | −70.9% | The JS goes from 380 076 B to 118 634 B. Loopback latency, nginx CPU and peak memory are within noise; no millisecond win is claimed. ## Check - `just lint test` is green: 190 bun tests, 14 Playwright, helm render tests. - A golden digest of status, content-type, Cache-Control and decoded-body sha for every first-load URL is identical before and after. - Headers checked in the pinned nginx image: `Content-Encoding: gzip` and `Vary: Accept-Encoding` on text responses; ETag 304s still work. Not run: the Containerfile image build and `e2e-full`. Session: 0e3485b3-1a4a-4b43-b4ba-4f6918ae6e83
Serves the built dist with the pinned nginx image and conf, then reports
wire bytes, latency, nginx CPU and peak memory, plus a golden of every
response's status, headers and decoded body.

Session: 0e3485b3-1a4a-4b43-b4ba-4f6918ae6e83
perf(resume): serve precompressed gzip twins of the text assets
All checks were successful
ci: resume-helm / Plan (pull_request) Successful in 3s
ci: resume-root / Plan (pull_request) Successful in 3s
ci: resume / Plan (pull_request) Successful in 3s
ci: resume-helm / CI (pull_request) Successful in 11s
ci: resume-helm / Image (pull_request) Has been skipped
ci: resume-helm / Publish & release (pull_request) Has been skipped
coverage/resume total 99.73% · changed lines 100.00% (25/25)
ci: resume-root / CI (pull_request) Successful in 25s
ci: resume-root / E2E (full stack) (pull_request) Has been skipped
ci: resume-root / Image (pull_request) Has been skipped
ci: resume-root / Publish & release (pull_request) Has been skipped
ci: resume-root / CI Pipeline (pull_request) Successful in 0s
ci: resume / CI (pull_request) Successful in 37s
ci: resume / E2E (full stack) (pull_request) Has been skipped
ci: resume / Image (pull_request) Successful in 38s
ci: resume / Publish & release (pull_request) Has been skipped
ci: resume / CI Pipeline (pull_request) Successful in 0s
ci: resume-helm / E2E (full stack) (pull_request) Successful in 59s
ci: resume-helm / CI Pipeline (pull_request) Successful in 0s
12b0425e19
Nothing on the path compressed: nginx shipped the 380 KB bundle raw and
Traefik's chain has no compress middleware. The build now writes a level-9
.gz beside each text file and nginx serves it via gzip_static, so a first
load drops from 773 KB to 433 KB on the wire with no runtime CPU.

Session: 0e3485b3-1a4a-4b43-b4ba-4f6918ae6e83
cjournois changed title from WIP: [spare] perf(resume): serve precompressed gzip twins of the text assets to [spare] perf(resume): serve precompressed gzip twins of the text assets 2026-11-16 15:46:45 +00:00
cjournois deleted branch perf/spare-optimize-resume 2026-11-16 15:46:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
needs-human
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cjournois/resume!174
No description provided.