System.Diagnostics.Stopwatch -- always remeber to use Reset
Wrong
System.Diagnostics.Stopwatch s = new System.Diagnostics.Stopwatch();
s.Start();
for (i = 0; i < count; i++) Test1();
s.Stop();
Console.WriteLine("Test1: {0}", s.ElapsedMilliseconds);
s.Start();
for (i = 0; i < count; i++) Test2();
s.Stop();
Console.WriteLine("Test2: {0}", s.ElapsedMilliseconds);
Right
System.Diagnostics.Stopwatch s = new System.Diagnostics.Stopwatch();
s.Start();
for (i = 0; i < count; i++) Test1();
s.Stop();
Console.WriteLine("Test1: {0}", s.ElapsedMilliseconds);
s.Reset();
s.Start();
for (i = 0; i < count; i++) Test2();
s.Stop();
Console.WriteLine("Test2: {0}", s.ElapsedMilliseconds);
Not that *cough* I would ever make this mistake or anything, but you know... it could happen to like, a friend, or something. Ya. My friend. :)