[perf] ReclaimDeletions compacts the whole deletion queue every frame (Device.cpp) #116

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

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

Location: implementations/Crafter.Graphics-Device.cpp:1012-1028
Severity: low · Effort: moderate · Category: cpu

Problem

ReclaimDeletions is called once per frame (Window.cpp:802) and does an O(n) walk + survivor copy over the whole deletion queue. retireAfter is monotonic, so the ready entries are always a prefix.

Fix

Ring buffer / deque::pop_front while the front is retired → O(ready). Minor in practice: the queue is empty in steady state and entries are 24 B contiguous.

Found by an adversarially-verified performance audit (confirmed real after a skeptic pass). **Location:** `implementations/Crafter.Graphics-Device.cpp:1012-1028` **Severity:** low · **Effort:** moderate · **Category:** cpu ### Problem `ReclaimDeletions` is called once per frame (`Window.cpp:802`) and does an O(n) walk + survivor copy over the whole deletion queue. `retireAfter` is monotonic, so the ready entries are always a prefix. ### Fix Ring buffer / `deque::pop_front` while the front is retired → O(ready). Minor in practice: the queue is empty in steady state and entries are 24 B contiguous.
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#116
No description provided.