300 - 400 CPU for requires?



  • Hi there

    I've read all the posts I could find about the CPU cost of requires at the beginning of the script. I'm still not sure, though, whether this is what I am experiencing:

    console.log(Game.cpu.getUsed()) at the beginning of the loop mostly indicates something between 0.1 and somewhere in the 30s, which is fine. In irregular intervals, however, the reported CPU usage at the beginning of the loop is between 300 and 400, sometimes over 400. If that happens, it can happen again the very next tick, or wait for 3 or 4 ticks before striking again, or it can disappear for minutes. Is that a normal pattern for require handling?

    I am executing 28 requires, importing approx. 249kb of source code. I read somewhere that having all this code in one file would not change much, so could anyone give me an idea, what to try? With a CPU limit of 110 and such CPU spikes, repeated script stops currently damper the fun.

    Thanks!



  • Hi again

    I logged all CPU spikes above 250 (at the beginning of the script) and the result shows how randomly these CPU spikes occur. Maybe the pattern would be clearer, if I would have included CPU spikes below 250 as well, but I wanted to have undoubted spikes in the data only.

    If anyone is interested in the data: https://mega.nz/#!4YM3xTqA!XXsOMYWX4aM2ZMs5QME8S6YubHEUY5nE5wJE9LRpGls