perf: avoid GetCustomAttributes() + LINQ chain for per-property attribute scans by thomhurst · Pull Request #6098 · thomhurst/TUnit (original) (raw)
Replace GetCustomAttributes() + OfType/Any/FirstOrDefault LINQ chains with a single-pass foreach that returns the first IDataSourceAttribute.
- ReflectionInstanceFactory: drops the OfType iterator + array allocation per property; common case (no data source) now allocates nothing extra.
- StaticPropertyReflectionInitializer: collapses the double attribute-array materialisation (filter + fetch) into one scan per property.
Skips ConstructorHelper.cs (#6056, separate open PR).
[](/apps/claude)
thomhurst deleted the perf/issue-6055-attribute-scans branch
This was referenced
May 29, 2026
This was referenced
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})