Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

High-Performance Timer vs StopWatch

Does anyone know if the HiPerfTimer or the StopWatch class is better for benchmarking, and why?

like image 799
Kane Avatar asked Sep 28 '09 07:09

Kane


People also ask

Does stopwatch affect performance?

The overhead of using Stopwatch is negligible. It just calls the Windows API function: QueryPerformanceCounter(). The overhead of using Stopwatch is negligible.

How accurate is the stopwatch class?

Stopwatch class does accurately measure time elapsed, but the way that the ElapsedTicks method works has led some people to the conclusion that it is not accurate, when they really just have a logic error in their code.


1 Answers

Stopwatch is based on High resolution timer (where available), you can check that with IsHighResolution

like image 98
Shay Erlichmen Avatar answered Sep 17 '22 14:09

Shay Erlichmen