P4: demote the hot-path SDL_Log lines to SDL_LogDebug #24

Open
opened 2026-08-02 18:33:04 -04:00 by tachikoma · 0 comments
Collaborator

Source: TODO.md, "Performance" -> "The plan", item 4 (at bbb7b8f)

akgl_actor_initialize logs every spawn (src/actor.c:51) and
akgl_character_sprite_add every binding (src/character.c:80). 20% of a spawn
is formatting a line nobody reads
, and that is with the output thrown away.

Demote them -- and src/character.c:285, src/renderer.c:34,
src/tilemap.c:660 -- from SDL_Log to SDL_LogDebug. SDL checks priority
before formatting, so the cost disappears at default priority and the messages
survive for anyone who turns debug on.

The spawn benchmark pair (tests/perf.c:410, :429) already measures exactly
this gap.

Files: src/actor.c:51, src/character.c:80,285, src/renderer.c:34, src/tilemap.c:660


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.md, "Performance" -> "The plan", item 4 (at bbb7b8f) `akgl_actor_initialize` logs every spawn (`src/actor.c:51`) and `akgl_character_sprite_add` every binding (`src/character.c:80`). **20% of a spawn is formatting a line nobody reads**, and that is with the output thrown away. Demote them -- and `src/character.c:285`, `src/renderer.c:34`, `src/tilemap.c:660` -- from `SDL_Log` to `SDL_LogDebug`. SDL checks priority before formatting, so the cost disappears at default priority and the messages survive for anyone who turns debug on. The spawn benchmark pair (`tests/perf.c:410`, `:429`) already measures exactly this gap. **Files:** `src/actor.c:51`, `src/character.c:80,285`, `src/renderer.c:34`, `src/tilemap.c:660` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 0.9.x milestone 2026-08-02 18:33:04 -04:00
tachikoma added the performanceblast-radius:low labels 2026-08-02 18:33:04 -04:00
tachikoma added the status::grooming label 2026-08-02 18:49:16 -04:00
Sign in to join this conversation.