Performance Comparisons (a Helper Class)

Not very special but useful: A helper class for performance comparisons using a Stopwatch.

You may know the Stopwatch class which enables much more accurate performance tests than the DateTime struct.

This little helper class makes it use a little bit easier and more comfortable.

Sample Test

Let’s look at a sample test first which introduces the syntax:

static void Main(string[] args)
{
    PerformanceTestRunner runner = new PerformanceTestRunner(1000, WhileLoop, ForLoop);

    runner.Run();

    foreach (PerformanceTestResult result in runner.Results)
        Console.WriteLine("Result of {0}: Minimum: {1}; Average: {2}", result.Test.Name, result.MinimumTicks, result.AverageTicks);

    Console.ReadKey();
}

Read the rest of this entry »

Advertisements

Threatfire and Visual Studio –> Debugging slowdown

Something prevented me from debugging!!! Why this excuse can be true in some situations.

Some days ago, I noticed that the Visual Studio 2008 debugger suddenly was very, very slow.

A simple “Step Over” took up to 10 seconds. Even worse was the performance of the “Immediate Window”. When evaluating an expression, the output was terribly slow, too.

As debugging in such a low speed is no fun any more, I had to find the reason. First I thought that changed settings, windows or plugins are responsible.

Read the rest of this entry »