[perf] shapedRuns_ eviction is all-or-nothing clear() at cap (UI-Shared.cpp) #123

Closed
opened 2026-06-17 21:18:54 +02:00 by jorijnvdgraaf · 0 comments

Found by an adversarially-verified performance audit (confirmed real after a skeptic pass).

Location: implementations/Crafter.Graphics-UI-Shared.cpp:112-113
Severity: medium · Effort: moderate · Category: algorithmic

Problem

At kMaxShapedRuns (8192) the cache does a full clear(). A stream of unique strings (FPS counters, timers) alongside many stable labels periodically nukes all stable entries, forcing a full-UI reshape on the next frame.

Fix

LRU / last-used-frame stamp + evict-oldest, keeping the hot set resident. Needs an auxiliary usage structure alongside the map. (Related to GPU-atlas eviction issue #55, but distinct — this is the CPU-side shaped-run cache.)

Verification

Confirm this actually improves net peformance.

Found by an adversarially-verified performance audit (confirmed real after a skeptic pass). **Location:** `implementations/Crafter.Graphics-UI-Shared.cpp:112-113` **Severity:** medium · **Effort:** moderate · **Category:** algorithmic ### Problem At `kMaxShapedRuns` (8192) the cache does a full `clear()`. A stream of unique strings (FPS counters, timers) alongside many stable labels periodically nukes all stable entries, forcing a full-UI reshape on the next frame. ### Fix LRU / last-used-frame stamp + evict-oldest, keeping the hot set resident. Needs an auxiliary usage structure alongside the map. (Related to GPU-atlas eviction issue #55, but distinct — this is the CPU-side shaped-run cache.) ### Verification Confirm this actually improves net peformance.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Catcrafts/Crafter.Graphics#123
No description provided.