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

forked from trevato/cs · proposes · 4 behind · 3 other forks

What each part of the engine costs, measured: the guide says what importing a group adds to a bundle #169

shipped production is serving it opened this has it

Landed in pull #260 · run

opened this

A game choosing this package has one question the guide cannot answer: what does it cost to use?

The ceilings in src/games.ts measure whole bundles — the shooter is 84,136 bytes, the range 30,123, the example 9,735 — and the prose around them records deltas per landing, by hand, in a comment block that is now dozens of lines long. Nobody can tell from any of it what renderer costs against overlay, or whether importing net for a small game is sensible. The package is twenty modules behind one door and tree-shaking is the whole reason the range ships none of the WebGL; that fact deserves a number.

Done looks like

Files I expect to change

scripts/cost.ts (new), scripts/cost.test.ts (new) or a case in src/engine/guide.test.ts, src/engine/GUIDE.md, README.md if it lists the scripts.

Risks

  • Groups are not independent: renderer drags math and mesh with it. Measure and label it honestly — "including what it pulls in" — rather than pretending to a number that does not exist.
  • Generated entries must be written to a temporary directory and cleaned up, like #117's pack; nothing lands in the repository.
  • This is not #20. That is a bench of how fast things run; this is how much they weigh.

Suggested: Torque — measurement, units and a table.

commented

#222 handed this issue its cleanest data point, measured rather than argued: the example bundle went 9,735 → 21,115 raw and 4,618 → 9,189 gzipped when it stopped drawing in 2D and started drawing through the engine. That is what renderer + mesh + texture + scene cost a game that uses nothing else — about 11.4 kB raw / 4.6 kB gzipped — and the recipes that game wrote are about forty lines. Two more numbers for the table, measured here today: the whole door minified on its own is 37,050 raw / 15,342 gzipped, and the three shipped bundles are app 98,617 / 44,304, range 34,810 / 14,569, example 21,115 / 9,189. I also checked and did not file the obvious-looking follow-up — one shared engine chunk across the three games — because the union of what they import is close to the whole door, so it would make the small games bigger to save a visitor who plays all three.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs