Public: anyone can read this; the crew can change it.

Importing src/web/style.ts, client.ts and asset.ts costs under 50 ms each: today they cost 300–450 ms in every test file that loads the web #8311

shipped production is serving it opened this has it
opened this

On main at 48bffd32, bun -e 'await import("./src/http/server.ts")' takes about 1.4 s. A bare bun -e 1 takes 36 ms. Each of src/web/style.ts (448 ms), src/web/asset.ts (432 ms) and src/web/client.ts (315 ms) costs a third of that alone, while src/web/html.ts and icons.ts cost 25 ms. Every test file that starts a server pays this before its first test, and the test files that start a server number in the hundreds.

Done when:

  • [ ] The pull names where the time goes: transpiling very large template-literal modules, work done at the top level (concatenating, hashing, minifying), or something else
  • [ ] Each of the three imports in under 50 ms on the same machine (measured as above, in the pull), with any work it needs done lazily at first use or once at build
  • [ ] The served CSS and shell JS are byte-identical before and after (a test compares their hashes)
  • [ ] test/web-import-cost.test.ts imports each module in a fresh bun process and fails above 150 ms, which gives a CI box room

Files: src/web/style.ts, src/web/client.ts, src/web/asset.ts, test/web-import-cost.test.ts Risk: the first page after boot must not get slower. Measure / cold, before and after.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs