View source for Talk:CPU constant
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
I am not skipping turns | 3 | 22:04, 22 October 2017 |
I measured some computation times and sometimes it's way more than 10ms per tick, without skipping a turn. My CPU constant is around 5ms. Are my measurements wrong or are there other possible explanations?
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:CPU constant/I am not skipping turns/reply.
I strongly suspect that if your thread doesn't pause often enough for long enough it will be paused by the JVM for a longer period for housekeeping tasks (GC, updating to JIT'd codepaths etc). I managed to create a fix for the ThreadDeath / long pause, which was simply adding a 1ms pause every tick. Maybe doing something like this would help on your side as well?
I tried 1ms Thread.Sleep at the end of each turn. Interestingly enough, sometimes it takes up to 10 ms It was never promised that it will sleep as much as asked, but factor of 10 is just nuts.
I see no significant change in the number of skipped turns.
I still get Thread.Death sometimes against simple/fast bots.
I really wish robocode itself would start garbage collector or at least call tread.sleep
. Recall our discussion where we observe that Thread.Death
disappears when in the GUI we set the desired FPS just a notch below max. I think the only difference that robocode inserts sleep
in the cycle if FPS is below max.