String Interpolation and StringBuilder in .NET6
09/26/2021
In a previous post I have looked into what are the performance characteristics of creating interpolated string in .NET 5 and early previews of .NET 6. With .NET 6 preview 7 or better a new approach is used by the C# compiler with support from the BCL to build interpolated strings.
Fortunately the new way provides a faster approach for the most convenient ways for assembling strings, however it makes my previous post completely obsolete.
For details about the new way
DefaultInterpolatedStringHandler
builds strings, read: https://devblogs.microsoft.com/dotnet/string-interpolation-in-c-10-and-net-6/
Re-running the benchmarks from the previous post, shows much better memory usage: