Closed GerardSmit closed 1 month ago
This PR reduces the allocations in .NET 7 and higher
BenchmarkRunner.Run<Benchmark>(); [MemoryDiagnoser] public class Benchmark { [Benchmark] public UPath Combine2() => UPath.Combine("/a", "b"); [Benchmark] public UPath Combine3() => UPath.Combine("/a", "b", "c"); [Benchmark] public UPath Combine4() => UPath.Combine("/a", "b", "c", "d"); [Benchmark] public UPath Combine5() => UPath.Combine("/a", "b", "c", "d", "e"); [Benchmark] public UPath Combine2WithAbsolute() => UPath.Combine("/a", "/b"); [Benchmark] public UPath Combine3WithAbsolute() => UPath.Combine("/a", "b", "/c"); [Benchmark] public UPath Combine4WithAbsolute() => UPath.Combine("/a", "b", "c", "/d"); [Benchmark] public UPath Combine5WithAbsolute() => UPath.Combine("/a", "b", "c", "d", "/e"); }
This PR reduces the allocations in .NET 7 and higher
Benchmark
Before
After