Skip to content

Refactor generator#4665

Merged
thomhurst merged 2 commits intothomhurst:mainfrom
TimothyMakkison:refactor_generator
Feb 5, 2026
Merged

Refactor generator#4665
thomhurst merged 2 commits intothomhurst:mainfrom
TimothyMakkison:refactor_generator

Conversation

@TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Feb 4, 2026

  • Change List usage to array
  • Reduce intermediary collection creation

Benchmarks - timing is inaccurate, I wanted to see memory usage

Before

Method Mean Error StdDev Median Gen0 Gen1 Allocated
RunGenerator 162.5 ms 6.15 ms 16.95 ms 155.1 ms 10000.0000 4000.0000 97.02 MB

After

Method Mean Error StdDev Median Gen0 Gen1 Allocated
RunGenerator 166.1 ms 6.86 ms 20.00 ms 155.8 ms 10000.0000 4000.0000 96.53 MB

@claude
Copy link
Contributor

claude bot commented Feb 5, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

This is a solid refactoring PR that aligns well with TUnit's performance-first philosophy. The changes reduce memory allocations by approximately 490KB through systematic optimization of collection usage in the source generator. The refactoring includes:

  • Converting List to arrays where appropriate
  • Eliminating unnecessary intermediate collection materializations
  • Removing unused method parameters (cleaner API surface)
  • Modernizing code with switch expressions and pattern matching
  • Improving category deduplication with HashSet

All changes are mechanical refactorings with no behavioral differences. The benchmark results demonstrate measurable performance improvements (97.02 MB to 96.53 MB allocated).

@thomhurst thomhurst merged commit 2eddf8c into thomhurst:main Feb 5, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants