I have a small problem regarding threading in C#. For some reason, my thread speeds up from 32ms delay to 16ms delay when I open Chrome, when I close Chrome it goes back to
You are hitting a resolution issue with DateTime
. You should use Stopwatch
for this kind of precision. Eric Lippert states that DateTime
is only accurate to around 30 ms, so your readings with it in this case will not tell you anything.
Measurement is half of your problem. The actual time variation for your loop is due to Sleep
resolution (as stated in the other answers).