I have been trying to find an elusive timeout bug in my CSB bot these last few days. I tried a lot of things but no luck. Then I decided that maybe it is the timing mechanism. I wrote a small bot: https://pastebin.com/P0P40wcs
The bot only measures time. Each loop iteration should take less than a microsecond, but it measures occasional jumps of over 1 ms, sometimes even 11 ms. I do this with steady_clock in C++, but I also tried high res clock (steady is better anyway because it “is_steady”). I don’t know why these jumps happen, but it does explain my bot timeouts, as i get the exact same size time jumps that time me out.
What causes this? It might be possible I am doing something wrong, but i dont see it.
Is it language-specific or arena-specific?
What can we do about it? Is there anything we can do besides set a wide margin?