.NET Stopwatch – performance penalty [duplicate]

The Stopwatch isn’t doing anything between the calls to Start and Stop… It just stores the current timestamp (via QueryPerformanceCounter) when you start it, and compare it to the current timestamp when you stop it. So there is no reason it could affect the performance of your code, at least not significantly. Stopwatch was designed specifically for accurate time measurements, so you can be sure it is thoroughly optimized. It is also much more accurate than comparing successive values of DateTime.Now. …

Leave a Comment