What is CLR profiler?

CLR Profiler is a .NET tool, developed by Microsoft, to evaluate the C# applications (.exe) performances.

You could CLR profiler to view statistics like Heap statistics, Garbage Collection statistics, GC Handle Statistics etc.

CLR Profiler interface:


For example, I can compare the differences between String concatenation and StringBuilder appending in a console application.


String concatenation:

public class StringBenchmark
{
    public void Build()
    {
        var text = "Hello"; ;
        for (var i = 0; i < 20000; i++)
        {
            text += "World";
        }
    }
}

Result:


StringBuilder appending:

public class StringBuilderBenchmark
{
    public void Build()
    {
        var builder = new StringBuilder().Append("Hello");
        for (var i = 0; i < 20000; i++)
        {
            builder.Append("World");
        }
    }
}

Result:

You can compare the differences in the two reports.


Download CLR Profiler

Comments