BenchmarkDotNet v0.13.12, Windows 10 (10.0.19045.3208/22H2/2022Update)
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET SDK 8.0.100
[Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
DefaultJob : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
Method | A | B | C | D | Mean | Error | StdDev | Gen0 | Allocated |
Concat | 10 | 20 | 30 | 40 | 60.60 ns | 1.270 ns | 1.738 ns | 0.0362 | 152 B |
Interpolated | 10 | 20 | 30 | 40 | 64.96 ns | 1.373 ns | 1.410 ns | 0.0172 | 72 B |
StringBuilder | 10 | 20 | 30 | 40 | 79.16 ns | 1.490 ns | 1.394 ns | 0.0669 | 280 B |
StringFormat | 10 | 20 | 30 | 40 | 119.31 ns | 2.423 ns | 3.475 ns | 0.0534 | 224 B |
Concat | 10 | 20 | 30 | 123456789 | 67.48 ns | 1.355 ns | 1.267 ns | 0.0497 | 208 B |
Interpolated | 10 | 20 | 30 | 123456789 | 70.90 ns | 0.928 ns | 0.775 ns | 0.0210 | 88 B |
StringBuilder | 10 | 20 | 30 | 123456789 | 81.96 ns | 1.601 ns | 1.572 ns | 0.0707 | 296 B |
StringFormat | 10 | 20 | 30 | 123456789 | 123.13 ns | 2.466 ns | 3.028 ns | 0.0572 | 240 B |