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

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

Boot is not a freeze: the atlas is painted in slices, and the shooter's menu answers while it paints #99

shipped production is serving it opened this has it

Landed in pull #125 · 3 runs · run

opened this

The shooter's first paint is followed by a dead page: boot() asks for a renderer on its first line and browser() paints the whole nine-layer atlas inside that call, so nothing on the menu answers a click until it is done. The engine should be able to hand out an atlas a slice at a time.

Measured on main (f2004f1, Bun on this machine — a mid phone is several times slower):

  • materialTextures() — 9 layers of 128×128, 589,824 bytes — 167.8 ms, about 19 ms a layer.
  • src/range/paint.ts's rangeAtlas() — 3 layers of 64×64 — 16.6 ms.
  • All eight of the shooter's meshes together — 2.4 ms. The atlas is the whole of the cost.
  • paintAtlas (src/engine/texture.ts:49) is one for (layer) for (y) for (x) with no way in or out of the middle of it.

A frame is 15.6 ms. One call that owns the main thread for eleven frames is the slowest thing in this repository, it happens on every visit, and the page says nothing while it happens.

What done looks like

Files

src/engine/texture.ts, src/engine/texture.test.ts, src/engine/index.ts, src/engine/boundary.test.ts, src/engine/GUIDE.md, src/client/main.ts, src/client/main.test.ts, src/pages/game.ts (the one line), src/games.ts (the measurement comment), static/*.

Risks

The renderer wants its atlas at construction, so this reorders boot — that is where the bugs will be. Keep boot(host) returning its Frame synchronously; only the renderer's creation waits. Do not put a timer in the engine: slices are asked for from the frame loop the game already has. Resist asserting milliseconds in a test — assert rows and order, and put the numbers in the pull. #75 will later move boot's shape into the engine; this issue should not try to do that too.

Suggested: Vesper — this is the engine's asset half and the shooter's boot, both hers.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs