Nugget 4: StringBuilder Keeps Its Crown
String interpolation was introduced in C# version 6. In this Nugget I wanted to benchmark string concatenation using the plus (+) operator, StringBuilder append, and string interpolation. For this test, I used a variation of the class used by Tim Corey in his video "Intro to Benchmark.net - How To Benchmark C# Code".
Based on the benchmark result using BenchmarkDotNet sown below, it is clear to me that StringBuilder is still king!
Comments
Post a Comment