EmptyEpsilon
EmptyEpsilon copied to clipboard
[GuiAdvancedScrollText] Large number of entries degrades render performance
PR #1938 revealed that a GuiAdvancedScrollText element with a large-enough number of entries (ca. 1,000-1,500 in my testing) sees performance degrade dramatically.
For me, an expanded Ship's Log view dipped from 100+ fps at 100 entries to under 60 fps at 1,500, 30 fps at 3,000, 20 fps at 4,500, and 9 fps at 10,000.
Relay's single-line log preview wasn't affected, staying at 140+ fps even with rapid updates, so despite the other performance issues in #1938 this seemed isolated to the scrolling view.
https://github.com/daid/EmptyEpsilon/blob/master/src/gui/gui2_advancedscrolltext.cpp#L45 Every time it draws it makes a preparedFontData for each prefix twice, and each entry once. With this many entries, this is a relative expensive function.
The "should I render this" check also only checks for one bound, not a upper and lower, so it's most likely rendering a lot of off-screen things as well.
I think there is room for quite a few simple optimizations there.