Tuesday, November 1, 2022

[FIXED] How accurate is System.Diagnostics.Stopwatch?

Issue

How accurate is System.Diagnostics.Stopwatch? I am trying to do some metrics for different code paths and I need it to be exact. Should I be using stopwatch or is there another solution that is more accurate.

I have been told that sometimes stopwatch gives incorrect information.


Solution

Why you don't profile your code instead of focusing on micro-benchmarks?

There are some good Open Source profilers like:



Answered By - Christian C. Salvadó
Answer Checked By - Gilberto Lyons (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.