Uh oh!
There was an error while loading. Please reload this page.
[Efficiency Improver] perf: eliminate yield-iterator and GroupBy allocations in IsIgnored() hot path - #8195
Conversation
…path IsIgnored() is called twice per test execution (class + method check in UnitTestRunner). The original implementation always allocated: - A compiler-generated yield-iterator state machine via GetAttributes<T>() - A GroupBy Lookup, even when the source sequence is empty This change walks GetCustomAttributesCached() directly: - Fast path (no condition attrs, most common): 0 allocations - Single-attr path: 0 extra allocations — evaluates directly - Multi-attr path: List<T> + GroupBy (same as before, minus state machine) For a 10,000-test suite with no ignored tests: ~20,000 state machine objects eliminated (~960 KB) ~20,000 GroupBy Lookup objects eliminated Net: ~40,000 fewer objects / ~1 MB less GC pressure per run Proxy metric: heap allocation count → GC pressure → energy consumption. GSF: Hardware Efficiency — fewer managed allocations reduce DRAM and GC CPU overhead per unit of test work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Amaury Levé (Evangelink)
commented
May 13, 2026
Copilot resolve the merge conflicts in this pull request |
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Merged |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Amaury Levé (Evangelink)
commented
May 13, 2026
Copilot address review comments |
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Addressed in commit |
Uh oh!
There was an error while loading. Please reload this page.
IsIgnored() is called twice per test execution (class + method check in
UnitTestRunner). The original implementation always allocated:
This change walks GetCustomAttributesCached() directly:
For a 10,000-test suite with no ignored tests:
~20,000 state machine objects eliminated (~960 KB)
~20,000 GroupBy Lookup objects eliminated
Net: ~40,000 fewer objects / ~1 MB less GC pressure per run
Proxy metric: heap allocation count → GC pressure → energy consumption.
GSF: Hardware Efficiency — fewer managed allocations reduce DRAM and GC
CPU overhead per unit of test work.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
Fixes#8159