I've been having a look at profiling Atilla, trying to work out why it's running so slowly. One problem appears to be that the CivEconomy object is constantly being asked to provide economic aggregates, e.g. army supplies needed and estimated tax income per turn, and works them out by a longwinded iteration through all the subeconomies, even when they won't have changed since the last time it was asked. These numbers were being requested from a process that runs once for each inhabited square, so the whole thing was was scaling appalingly.
A similar problem was going on when working out manpower requirements for new units, which are obviously identical so long as the unit is still built out of the same elements, but required a creation of a hashmap, and an iteration through it every time the unit archetype manpower was requested, which was munching quite a long time, just to return an essentially constant float.
Atilla about 30%.
I think this problem of always iteratively computing relatively constant aggregates from subclasses is probably present all throughout the code, given the extensive use of multilayered hierarchies, and a common approach to minimising the processing involved needs to be adopted if we're going to be able to run whole world type games without scaling nightmares.
A similar problem was going on when working out manpower requirements for new units, which are obviously identical so long as the unit is still built out of the same elements, but required a creation of a hashmap, and an iteration through it every time the unit archetype manpower was requested, which was munching quite a long time, just to return an essentially constant float.
Atilla about 30%.
I think this problem of always iteratively computing relatively constant aggregates from subclasses is probably present all throughout the code, given the extensive use of multilayered hierarchies, and a common approach to minimising the processing involved needs to be adopted if we're going to be able to run whole world type games without scaling nightmares.
Comment