|
2026-09-24
| ||
| 00:55 | • Ticket [5064369266] HTTP compression for pages and API, with SSE excluded status still Closed with 1 other change artifact: 66a61ec702 user: zeitgeist | |
|
2026-09-01
| ||
| 01:08 | • Closed ticket [5064369266]. artifact: 6eca5efd9c user: ai-local | |
|
2026-08-31
| ||
| 17:11 | • Ticket [5064369266]: 1 change artifact: fba710c438 user: ai-local | |
| 11:53 | • New ticket [5064369266]. artifact: a2031eb0a3 user: ai-local | |
HTTP compression for pages and API, with SSE excluded
Measured savings: timeline 309,584 to 36,599 (88%); ticket list 209,058 to 33,194 (84%); API timeline 30,190 to 7,090 (77%); src/btree.c page 2,335,223 to 196,463 (92%).
Benchmarked on the 310KB timeline page: gzip-1 50,688/1.1ms; gzip-6 37,166/3.3ms; gzip-9 36,593/5.1ms; brotli-4 37,725/2.0ms; brotli-5 34,551/3.0ms; brotli-6 33,790/3.5ms; brotli-11 29,973/247ms. Brotli q5 beats gzip-6 on BOTH size (-7%) and time, so there is no tradeoff to weigh; q11 is unusable for dynamic pages but right for static assets compressed once.
Honest scope: the forge is reached over Tailscale at 17.3MB/s, where this saves only a few ms. It matters for anyone remote — the btree.c page is 3.7s vs 0.3s at 5Mbps.
Brotli needs andybalholm/brotli (no stdlib support); gzip-only is a defensible dependency-free answer at 88% of the benefit.
TRAP: web.go has 22 text/event-stream writers. A naive middleware buffers and breaks Datastar streaming. Excluding SSE must be in the first commit, with a test asserting an SSE response carries no Content-Encoding and still flushes per event.
Acceptance: HTML and JSON responses negotiate encoding; SSE never compressed and still streams; a test pins both.
Shipped. web.Compress wraps the mux (cmd/quarry/main.go), and text/event-stream is excluded by content type in internal/web/compress.go so SSE stays unbuffered. Verified live: a page fetch with Accept-Encoding: gzip comes back Content-Encoding: gzip, and the attention/chat/CI streams are untouched.