I've added some code to dump performance data to the script-specific dump log now. It measures all calls to events and timers, and finds the worst single call (with the game time it occurred at), average call time, and how many calls fall into two bins (higher than 25ms and higher than 50ms).
Here is an example from measuring nullbot on a very big high-oil map (using nullbot since it has many more timers to measure than semperfi-js):
regroupRegularly() is a well named function! And, wow, huntForOil() needs some investigation.
Anyway, this is extremely useful stuff - much easier to find bottlenecks now. I like the fact it's tracking #calls as well.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per wrote:I've added some code to dump performance data to the script-specific dump log now. It measures all calls to events and timers, and finds the worst single call (with the game time it occurred at), average call time, and how many calls fall into two bins (higher than 25ms and higher than 50ms).
Anything above 5ms is way too much. (heck, I would think anything above 3ms, but I am not sure what kind of overhead we have with the script stuff right now.)
While it may not seem like much, once you start adding in more AIs, then that 5ms can quickly climb to 45ms for 9 AI players.
I also think that if a function really is that slow, it would be much better to have support on the C++ side, but it should be a widely used function, and not something specific to the AI in question.
/facepalm ...Grinch stole Warzone contra principia negantem non est disputandum Super busy, don't expect a timely reply back.
Well, with this new feature at least now we can see which functions need attention. There are plenty of ways to speed things up, we just needed this log to let us know where to focus efforts.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Just started using it. It's very helpful, much better than it used to be.
I just take a saved game, repeatedly reload it, run for ~30 seconds and observe the result, change the script, reload the same game again, ... until i get 0ms everywhere (: