You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
yokotoka
committed
Fix progressive input lag from per-frame heap allocations and redundant font metrics
Three targeted optimizations in the terminal rendering hot path:
1. Replace per-frame heap allocations with pre-allocated buffers
- updateImage() allocated/freed wchar_t[] and char[] arrays every frame
- Over long sessions this caused heap fragmentation, progressively
slowing allocation and increasing input latency
- Now uses std::vector member variables that resize only on terminal
dimension changes
2. Hoist QFontMetrics construction out of per-line loop
- QFontMetrics was recreated for every line in updateImage(), up to
50+ times per frame for a typical terminal
- Now created once per updateImage() call
3. Skip horizontalAdvance() for fixed-width fonts
- For monospace terminal fonts (_fixedFont == true), character width
is constant and already known as _fontWidth
- Eliminates expensive font shaping engine lookups in both
updateImage() and drawContents()
0 commit comments