[perf] Win32 StartSync busy-spins one core at 100% when not updating (Window.cpp) #134
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#134
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?
Found by an adversarially-verified performance audit (confirmed real after a skeptic pass).
Location:
implementations/Crafter.Graphics-Window.cpp:700-713Severity: medium · Effort: trivial · Category: cpu
Problem
When
updatingis false (paused/minimized/stopped), thePeekMessage(PM_REMOVE)loop pins one core at 100%, repeatedly runningGamepad::Tick()(mutex + per-padGetCurrentReadingCOM call) +onBeforeUpdate. (When updating, FIFO present paces the loop, so per-frame polling is correctly vsync-gated — the "decoupled" concern there was refuted.)Fix
Block on
MsgWaitForMultipleObjectsEx/WaitMessagewhile!updating.