Does anyone know if the HiPerfTimer or the StopWatch class is better for benchmarking, and why?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
They are the same when it comes to high resolution timing.
Both use this:
and this:
to do the underlying timing. (You can verify this with Reflector.NET). I'd use StopWatch because it's part of the framework already (no need to link another dll) and it had better features than HiPerfTimer.
Stopwatch is based on High resolution timer (where available), you can check that with IsHighResolution
StopWatch- it also works on systems that don't support a high resolution performance counter and you don't need any external libraries to use it.
The other one throws an Win32Exception if there is no support for a high resolution counter.