perf(engine): avoid string round-trip when building nested type names (#6049) by thomhurst · Pull Request #6075 · thomhurst/TUnit (original) (raw)
BuildClassNameForMatching and WriteTypeNameWithGenerics formatted each
nested-type segment into a scratch ValueStringBuilder, materialised a
string via AsSpan().ToString(), stored it in a ValueListBuilder<string>,
then re-emitted it into the outer builder. Per generic/nested type that
allocated a throw-away string plus extra copies.
Collect the nested-type chain as ValueListBuilder<Type> and emit each
segment directly into the outer ValueStringBuilder in reverse via a
shared AppendTypeNameWithGenericArgs helper. No intermediate strings.
Closes #6049
[](/apps/claude)
Addresses review feedback on #6075 — the extraction had duplicated the method into both MetadataFilterMatcher and TestIdentifierService. Move it to a single internal TUnit.Engine.Helpers.TypeNameHelper so the two call sites cannot diverge.
[](/apps/claude)
thomhurst deleted the perf/6049-aspan-tostring 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 }})