View source for Talk:CPU constant

From Robowiki
Jump to navigation Jump to search

Contents

Thread titleRepliesLast modified
I am not skipping turns322:04, 22 October 2017

I am not skipping turns

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?

Cb (talk)00:55, 22 October 2017

Yes, I've seen something like this in my profiler. I quickly look at the source, I think the problem is that robocode does not use System.nanoTime to compare times. Instead it using Java to trow exception if wait time is exceeded. It is possible that java treat it as low priority and skips the exception.

I noticed that with similar CPU demand from my bot, I am skipping significantly more against simple/fast bots. Sometimes even 30 turns which causes infamous ThreadDeath. I.e. if i run against Diamond, I see less skipped turns than against a rammer or HawkOnFire. Why is it so I do not understand. But it might be connected to your case.

Beaming (talk)03:01, 22 October 2017

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?

Skilgannon (talk)11:06, 22 October 2017

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:CPU constant/I am not skipping turns/reply (3).