CPU volatility

  • I was just testing different functions to get an idea how heavy they are for CPU load, but i noticed the enormous volatility for exactly the same code execution.

    I run 50 times the findPath function for a static locations (and no other code at all). On average this takes about 40 CPU, but the standard deviation is 30 which is 75%! Why do we have this volatility and can this ever be fixed or limited?

  • I think it also accounts for the creeps on the way. So if you are running it with default settings, it would try to path around these creeps.

    opts (optional) object
    An object containing additonal pathfinding flags:
    ignoreCreeps boolean
    Treat squares with creeps as walkable. Can be useful with too many moving creeps around or in some other cases. The default value is false.

  • There are no creeps or any other objects at the "test site".

  • Agree. Also things as creating empty objects or searching room has annoying high volatility. For example,

    var t=Game.getUsedCpu();
      Game.rooms.W4N5.find(FIND_DROPPED_ENERGY); // 1.5-5.5 CPU

    Spends 1.5 to 5.5 CPU units despite the averaging of 100 calls.
    I did several tests and you can see how much each eats CPU at the bottom of (https://github.com/Akuukis/screeps)