[perf][LOW] CRAFTER_TIMING frame-time history uses erase(begin()) every frame #44
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Subsystem: Window / swapchain / frame loop (timing builds only)
Location:
implementations/Crafter.Graphics-Window.cpp:660-665Impact: LOW · Effort: Small
Problem
frameTimes.erase(frameTimes.begin())memmoves ~100 elements left every frame once full. Compiled only inCRAFTER_TIMINGbuilds.Proposed fix
Fixed-size ring buffer (
std::array<nanoseconds,100>+ head).LogTimingdoes order-independent sum/avg/min/max, so a ring works. KeepupdateTimingsas a capacity-reused vector.Note
The "skews measurement" framing is exaggerated — ~99×8 bytes, L1-resident, single-digit ns, dwarfed by the
clock::now()calls already in the timing path.