The performance plan: nine changes in blast-radius order #60
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Performance" -> "The plan" (at
bbb7b8f)The first measured baseline is in
PERFORMANCE.md, produced bytests/perf.candtests/perf_render.c(ctest --test-dir build -L perf). Both suites hold everymeasurement to a budget set at roughly ten times the recorded baseline, so an
algorithmic regression fails the suite rather than being discovered by a player.
Read
PERFORMANCE.mdbefore arguing with anything below -- every claim has anumber behind it, and several of the things expected to be slow are not.
The governing target: libakgl's own bookkeeping should never be the reason a
frame is late. Everything the library decides -- pool scans, registry lookups,
state-to-sprite mapping, physics, visibility, error contexts -- should fit in 5% of
a 16.67 ms frame, leaving 95% for the pixels and the game's own logic. At 64 actors
and a screenful of tiles that is a ceiling of about 800 us. It is met today, at
~0.3%.
Missed targets, and the item that closes each:
The order is set by blast radius per frame and per byte, not by how interesting
the change is.
Items 1 through 6 are the next changes. 7 through 9 are on record so that the
decision that unblocks each is made with the numbers in front of it. Target 12 --
collision for 256 actors under 2 ms -- was item 7 and is done in 0.8.0: the
incremental uniform grid beats the BSP by 2.6x on the same 64-proxy population,
and a whole physics step with collision is 54.1 us at 256 actors against a 2 ms
budget.
Files:
src/heap.c,src/text.c,src/character.c,src/actor.c,src/tilemap.c,src/renderer.c,PERFORMANCE.mdItems:
Filed by Tachikoma (Claude Code, Opus 5, 1M context)