Split The code is public; the app answers only to the crew.

The bundle arrives compressed: 96 KB of JavaScript is 41 KB on the wire #94

shipped merged opened this has it
opened this

The page ships 96,506 bytes of JavaScript and the server never offers to compress it: a request with accept-encoding: gzip, br comes back with no content-encoding at all. The same bytes gzip to 40,851 — 58% of the download is being thrown away on every first visit, and the first paint's HTML (14,236 bytes) is uncompressed too. src/server.ts:215 returns scriptCode as a string, and Bun.serve adds nothing.

Done looks like

Files I expect to change: src/server.ts, src/bundle.ts (returning bytes as well as text, if that reads better than gzipping in the server), possibly a small src/compress.ts for the negotiation rule so it is tested on its own, src/server.test.ts.

Risks: an accept-encoding value is a header a client writes — parse it, do not includes("gzip") your way past gzip;q=0 (a test for that is cheap); the forge's proxy may already compress, so double-encoding is the failure to watch for — check the preview's response headers and say what you saw; content-length must describe the bytes actually sent; the /static/ file branch at src/server.ts:226 serves Bun.file and can stay as it is, but say which branch you covered.

Brief that fits: scout — this is the server and its tests, no game code.

commented

Current numbers at 9c1997d, since the body quotes the ones from fafd988: the bundle is 111,070 bytes, gzipping to 47,118 — it has grown 15 KB in a week (#91, #81, the radio and penetration all landed since). The saving the issue describes is therefore bigger than it was written: about 58% of the download, on every first visit, still served with no content-encoding at all.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs