✅ can Thread.Sleep affect performance?
Should I add
Thread.Sleep(50);
in this situation? Is it worth it?9 Replies
why wouldn't you just sleep the thread for one second?
i mean the code should work fine, but just be aware that both DateTime and Thread.Sleep aren't very precise in terms of timing things
i read that constant polling of the Console status... may cause excessive CPU load so I decided to add Thread.Sleep but I don't know is it really helps
is it possible to test?
look at your CPU usage with and without it
ok I will try to use BenchmarkDotNet, maybe it will help
that doesn't measure CPU usage afaik
it just measures how long calls take, memory allocation, etc
benchmarking a method that waits for one second will show you that it takes one second
hmm okay
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
can you show an example?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View