Rastikko / screeps-lodash

Lodash based screeps codebase
2 stars 1 forks source link

CPU ocasionally spikes #6

Open Rastikko opened 8 years ago

Rastikko commented 8 years ago

I've tried to understand why and looks like is happening in the requires at the begging:

console.log('before: ', Game.cpu.getUsed())
require('_room');
require('_spawn');
require('_creep');
require('_source');
require('_tower');
var commander = require('commander');
var metaAlpha = require('meta-alpha');
console.log('after: ', Game.cpu.getUsed())

Perhaps the require is that expensive? Maybe we should concatenate files with grunt concat.

Kill4Free commented 8 years ago

Mhh could be that the I/O Op is included inside the CPU.

Rastikko commented 8 years ago

Actually, this might be a server side issue: http://support.screeps.com/hc/en-us/community/posts/206915829-Extreme-increase-in-CPU-usage-with-the-same-script