Hello Will
I have a bottleneck in some part of my .net programming code that I need to measure the time it takes to run as accurately as possible. What is the best way to measure the performance?
Sheri from Gaithersburg
Hello Will
I have a bottleneck in some part of my .net programming code that I need to measure the time it takes to run as accurately as possible. What is the best way to measure the performance?
Sheri from Gaithersburg
Comments are closed.
Hello Sheri
The best way to measure performance in .net programming is to use Stopwatch from System.Diagnostics
Stopwatch sw = Stopwatch.StartNew();
// Execute your work
sw.Stop();
Console.WriteLine("Time taken: {0}ms", sw.Elapsed.TotalMilliseconds);
Stopwatch automatically checks for the existence of high-precision timers.
Will