csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

perf: add new `Concat` types for children lengths

Open TimothyMakkison opened this issue 10 months ago • 0 comments

Taking inspiration from Roslyn I added several implementation of Concat one for each number of children and WithManyChildren. This lets us use Concat(params ReadOnlySpan<Doc> values, this way we can use WithTwoChildren or WithThreeChildren when there is a small numbers of values, only allocating to an array when there is a large number of Doc types.

This currently saves 2 MB (6% memory usage) however I expect this number to go up when combined with #1502

TimothyMakkison avatar Mar 06 '25 22:03 TimothyMakkison