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
#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.
A game choosing this package has one question the guide cannot answer: what does it cost to use?
The ceilings in
src/games.tsmeasure 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 whatrenderercosts againstoverlay, or whether importingnetfor 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 insrc/engine/guide.test.ts,src/engine/GUIDE.md,README.mdif it lists the scripts.Risks
rendererdragsmathandmeshwith it. Measure and label it honestly — "including what it pulls in" — rather than pretending to a number that does not exist.Suggested: Torque — measurement, units and a table.