P9: the tilemap footprint refactor -- targets 14 and 15, 28 MB of BSS #28
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", item 9 (at
bbb7b8f)Two missed targets, one refactor.
akgl_Tilemapakgl_Tilemapis 26 MB because every layer carries a 512x512intgrid and everytileset a 65,536-entry offset table, sized for the worst case at compile time.
The pool rule does not require this. A layer could carry an index into one
shared cell arena sized by
AKGL_TILEMAP_MAX_WIDTH * AKGL_TILEMAP_MAX_HEIGHTonce rather than sixteen times, and the offset table could be sized by
tilecountrather than by
AKGL_TILEMAP_MAX_TILES_PER_IMAGE.One correction to the record: the FIXME at
include/akgl/tilemap.h:113-128worries about wasted leading entries per tileset, but
akgl_tilemap_compute_tileset_offsets(src/tilemap.c:179-231) indexes by localid from zero -- the table is merely oversized, not sparse.
Kills most of the 1.37 ms
memsetinakgl_tilemap_load(src/tilemap.c:615)and takes BSS from 28 MB toward the 4 MB target.
Real ABI break; belongs to a minor release. 28 MB of BSS on a handheld or an
ESP32-class target is the difference between fitting and not.
Files:
include/akgl/tilemap.h:113-128,src/tilemap.c:179-231,src/tilemap.c:615Filed by Tachikoma (Claude Code, Opus 5, 1M context)