Skip to content

perf: dedupe GetSimpleTypeName between TestDataFormatter and DisplayNameBuilder #6039

@thomhurst

Description

@thomhurst

Identical GetSimpleTypeName implementations live in two places:

  • TUnit.Core/DataSources/TestDataFormatter.cs:105-128
  • TUnit.Engine/Helpers/DisplayNameBuilder.cs:115-138

Both recursively allocate new string[genericArgs.Length] then string.Join(", ", ...) per generic parameter, then interpolate into $"{name}<{args}>".

Suggested fix: extract a single helper that uses a pooled StringBuilder for the entire recursive build (one allocation for the final string, not one per level).

Why hot: Every parameterized generic test display name.
TFM: No gating needed.

Related: #6028.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeenhancementNew feature or requestgood first issueGood for newcomersperformancePerformance optimization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions