Posts Tagged .NET Profiler
.NET StringBuilder — Fast, but not as fast as you think!
Posted by eric in C# Programming, General Programming, Microsoft .NET 3.0 / WinFX, Reverse Engineering on May 28, 2009
I recently ran into a situation where I was tasked to profile some .NET code and do some optimizations anywhere hot spots popped up. I was amazed to find out that one of the BIGGEST offenders in our code block was a simple call to StringBuilder.Append(char). I had to take a step back and scratch my head and wonder if my profiler was confused.
I re-ran some tests using the StopWatch class to hard code some metrics into the application and they also confirmed the findings. What’s up? How could a class that everyone says you can use to your hearts content when it came to string concatenation was failing me?
Turns out, it was a mix of misuse and a common misconception about the StringBuilder Class.
Continue reading “.NET StringBuilder — Fast, but not as fast as you think!” »


