Skip to content

Conversation

@TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Oct 27, 2025

  • Add Concat(IEnumerable) overload to remove ToArray call. This is beneficial because most uses only have one item so we don't have to create an array.
  • Prevent repeat calls to syntaxToken.LeadingTrivia
  • Use ValueListBuilder inside Doc.Join

Benchmark (Timing is inaccurate)

Before

Method Mean Error StdDev Median Gen0 Gen1 Allocated
Default_CodeFormatter_Tests 131.9 ms 3.30 ms 8.86 ms 128.0 ms 3000.0000 1000.0000 34.57 MB
Default_CodeFormatter_Complex 261.3 ms 5.16 ms 4.03 ms 261.3 ms 5000.0000 2000.0000 53.03 MB

After

Method Mean Error StdDev Gen0 Gen1 Allocated
Default_CodeFormatter_Tests 139.0 ms 2.96 ms 8.59 ms 3000.0000 1000.0000 34.35 MB
Default_CodeFormatter_Complex 282.8 ms 5.59 ms 13.39 ms 5000.0000 2000.0000 52.53 MB

@TimothyMakkison TimothyMakkison force-pushed the concat_ienumerable_2 branch 2 times, most recently from 37aaa9e to c6c29d6 Compare October 30, 2025 23:27
@TimothyMakkison TimothyMakkison marked this pull request as ready for review October 30, 2025 23:27
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.

1 participant