DOM ENGINEV0.21.3FIZLET

06 DOCS · BUDGETS

Every kilobyte
is a choice.

Each module has a size budget, and CI fails when one is over. The kernel is 3,372 B gzip against a budget of 4,096 B. The table below is not typed: this page is built by the same code that checks the budgets, so the numbers are the ones measured on v0.21.3.

Measured on this build

EntryGzipBudgetUsed
@fzlt/core (kernel)3,372 B4,096 B82%
@fzlt/core/debug486 B1,536 B32%
@fzlt/core/perf2,019 B2,022 B100%
@fzlt/core/input1,335 B1,536 B87%
@fzlt/core/pad2,068 B2,120 B98%
@fzlt/core/collide1,265 B1,536 B82%
@fzlt/core/grid1,652 B1,664 B99%
@fzlt/core/fx2,792 B3,072 B91%
@fzlt/core/camera1,400 B1,536 B91%
@fzlt/core/sprite1,437 B1,536 B94%
@fzlt/core/sound1,062 B1,536 B69%
@fzlt/core/embed2,040 B2,560 B80%
@fzlt/core/slot1,849 B2,048 B90%
@fzlt/core/presence2,197 B2,240 B98%
@fzlt/core/presence/check4,870 B5,120 B95%
@fzlt/core/hud1,306 B1,536 B85%
@fzlt/core/match2,617 B2,816 B93%
@fzlt/core/rules1,318 B1,536 B86%
@fzlt/core/steer1,148 B1,280 B90%
@fzlt/core/coach1,220 B1,536 B79%
@fzlt/core/timeline2,137 B2,304 B93%
@fzlt/core/touch310 B512 B61%
@fzlt/core/css-clock5,368 B5,566 B96%
@fzlt/core/layout1,747 B2,048 B85%
@fzlt/core/view-canvas936 B1,229 B76%
@fzlt/core/arcade24,147 B24,150 B100%
@fzlt/core/arcade (hud omitted)18,200 B18,201 B100%
@fzlt/core/board-page4,103 B4,160 B99%
page build (kernel+slot+input+fx)7,094 B7,104 B100%
@fzlt/core/ui (js)2,907 B3,072 B95%
@fzlt/core/ui (css)5,139 B5,152 B100%

Minified and gzipped with everything each entry pulls in (1 KB = 1024 bytes), the way npm run size checks it in CI. Over a budget, the build fails.

How we measure

  1. One measurement. scripts/sizes.mjs bundles each entry with esbuild (ESM, ES2022, minified), gzips the output and compares it with the budget. npm run size (CI) and the website both call it, so a page can't show a number CI didn't check.
  2. Everything it imports. A brick's size includes the kernel parts it pulls in. That is what a page pays for it alone.
  3. Live bytes for demos. Every live demo on this site wears a size badge: the gzip of the chunk it loads plus its static imports, measured at build. The site test measures it again and fails if they disagree.
  4. Budgets move only with a reason. When one goes up, the changelog says how much and why, and the release notes keep it.

The hero budget

A page hero's live chunk (kernel, bricks and the scene's own code) has a budget of 10 KB gzip. The page build (kernel, @fzlt/core/slot, @fzlt/core/input and @fzlt/core/fx) is 7,094 B against 7,104 B, which leaves about 3 KB for the scene. A test fails if sound, debug, the pad, the HUD, match or the Board UI get into it.

The two story heroes on the home page are inside it. Measured in 0.19.0: the layers scene's live chunk is 9,727 B and the fizz scene's 8,752 B, each loaded only once its slot nears the viewport. How small is small walks through the numbers.

Questions

Why gzip and not minified bytes?

Because gzip is what crosses the wire for a script on almost every host. The changelog gives minified bytes too where a change is about them.

Why is @fzlt/core/arcade so much bigger?

It is a shell, not a brick: it composes the kernel, board-page, input, the pad, sound, the HUD and the Board UI keys, so a page game is only its rules and art. Its budget counts all of them.