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
perf: eliminate per-tick allocations in GenerateLinesToRender via cached buffers
Cache the four working buffers (List<object>, TestProgressState[],
int[], List<TestDetailState>?[]) and the sort comparer as instance
fields on AnsiTerminalTestProgressFrame so they are allocated once per
frame object rather than on every render tick.
- _linesToRenderBuffer: reused List<object> (was: new list each tick)
- _progressItemsBuffer: grown-only array (was: new array each tick)
- _sortedIndicesBuffer: grown-only array (was: new array each tick)
- _detailItemsBuffer: grown-only array (was: new array each tick)
- _progressCountComparer: cached IComparer<int> instance used with
Array.Sort(array, offset, count, comparer) so no closure is captured
(was: Array.Sort(array, Comparison<T> lambda) → 1 closure/tick)
At ~2 fps with N assemblies this removes ~5N allocations per second.
For a typical run with 4 assemblies over 5 minutes, this is roughly
~12 000 allocations eliminated.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments