Opened 7 years ago
Last modified 3 years ago
#4293 new enhancement
Optimize the Timer calls to Unit.Gather.Gathering in UnitAI
Reported by: | wraitii | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | Simulation | Keywords: | |
Cc: | Patch: |
Description
From some profiling, a rather long time is spent in Timer.js each turn and the bulk of that are gather timers. The repeated calls are rather slow, as the function in general is rather slow.
In an MP 2v2, we are talking around 7/8ms per turn here, which is not negligible. We should try to optimize this as much as possible.
Change History (4)
comment:1 by , 7 years ago
comment:3 by , 5 years ago
Component: | UI & Simulation → Simulation |
---|
Move tickets to Simulation
as UI & Simulation
got some sub components.
Note:
See TracTickets
for help on using tickets.
I've done some work in this branch, trying to get the lower hanging fruits out first: https://github.com/wraitii/0ad/tree/GatherOptim
The profiling can be done with https://github.com/wraitii/0ad/tree/simProfiler
Here I'm mostly removing messages from ResourceSupplyChanged to direct calls to AiProxy and StatusBars, which are the only two listening to it. We might be able to do without the "if" but that could be unsafe if we ever start doing weird stuff. That long with caching the player cheat multiplier (which is static in game for each player) allows around a 50% improvement to the running time.