Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Bell Tower peal-length page test is slow (≈4.5 s) and needed a 30 s budget #122
Check · Review · Land · Live done — Landed and live in production.
The Bell Tower peal-length page test now takes about 0.7 s here, down from about 1.6 s, and the 30 s limit is gone. Locally it ran 1.6 s, not the 4.5 s in the issue, which was probably a loaded machine. I ran only that test file, not the whole suite.
shipped production is serving it deploy ab54f53
The Bell Tower peal-length page test now takes about 0.7 s here, down from about 1.6 s, and the 30 s limit is gone. Locally it ran 1.6 s, not the 4.5 s in the issue, which was probably a loaded machine. I ran only that test file, not the whole suite. I skipped bun scripts/gate.ts and scripts/fast.ts, so the forge's check is the first run of those. bun x tsc --noEmit printed its help text instead of checking, so the type check didn't actually run here.
Why it was slow: nothing waits on real time. The playtest.mjs harness steps the page at 25 fps and the page paints every frame. That costs about 4.8 ms a frame, mostly the bell and rope shapes plus the edge shading, and the old test stepped about 330 frames. The page already limits each frame's time step, so I couldn't cut the frame count by taking bigger steps.
What changed (bell-tower/page.test.mjs only):
- Fewer frames: the test drops the opening
run(1). It no longer waits 0.6 s after every tap. It waits one bell-swing (SWINGfrompeal.js) only when the next bell is the one just rung, because a bell can't be pulled again while it swings. - Earlier check: the HUD check on the longer peal now happens when the tower starts that peal (
phase === 'listen'), which is where the page updates the HUD to 4. The old version waited through the whole listening round to the player's turn. It still asserts the HUD reads 3, that the score is 3, and that the peal grew to 4. - Timeout: the explicit
30000is removed, so the test runs under bun's 5 s default.
Not done: I didn't speed up the page renderer or add a "skip painting" mode to playtest.mjs. No single step in the paint is worth changing, and the test no longer needs it.
Test-only change, scoped to the issue. The test passes here in about 1.3 s and the 30 s override is gone. It still asserts HUD 3, score 3 and HUD 4, and it now checks the HUD at the listen event where the page updates it. Waiting SWING only when the same bell repeats matches peal.js. Next, if you want: (1) assert the HUD length before the player completes the peal (already covered by the HUD 3 check); (2) add a repeated-bell case so the SWING wait branch is tested deliberately rather than depending on the seed.
The Bell Tower peal-length page test now takes about 0.7 s here, down from about 1.6 s, and the 30 s limit is gone. Locally it ran 1.6 s, not the 4.5 s in the issue, which was probably a loaded machine. I ran only that test file, not the whole suite. I skipped
bun scripts/gate.tsandscripts/fast.ts, so the forge's check is the first run of those.bun x tsc --noEmitprinted its help text instead of checking, so the type check didn't actually run here.Why it was slow: nothing waits on real time. The
playtest.mjsharness steps the page at 25 fps and the page paints every frame. That costs about 4.8 ms a frame, mostly the bell and rope shapes plus the edge shading, and the old test stepped about 330 frames. The page already limits each frame's time step, so I couldn't cut the frame count by taking bigger steps.What changed (
bell-tower/page.test.mjsonly):run(1). It no longer waits 0.6 s after every tap. It waits one bell-swing (SWINGfrompeal.js) only when the next bell is the one just rung, because a bell can't be pulled again while it swings.phase === 'listen'), which is where the page updates the HUD to 4. The old version waited through the whole listening round to the player's turn. It still asserts the HUD reads 3, that the score is 3, and that the peal grew to 4.30000is removed, so the test runs under bun's 5 s default.Not done: I didn't speed up the page renderer or add a "skip painting" mode to
playtest.mjs. No single step in the paint is worth changing, and the test no longer needs it.Closes #113