Opened 7 years ago
Closed 6 years ago
#4322 closed defect (fixed)
Improve unit selection performance by rearranging GetEntityState following r18773
Reported by: | mimo | Owned by: | echotangoecho |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | UI & Simulation | Keywords: | |
Cc: | Imarok | Patch: | Phab:D1223 |
Description (last modified by )
Because of the loop lines 436/442 of gui/session/selection_details.js introduced in r18773, GetExtendedEntityState is now called for all selected entities while it was designed to complete the EntityState with the rarely used variables and be called only on rare occasions (usually only the first selected entity) when needed. Testing on Combat Demo Huge by selecting 200 units without doing anything, the "gui sim update" profile info goes from about 29ms/turn when calling only GetEntityState in that loop (so missing a few variables) to 47 ms/turn with the current GetExtendedEntityState.
- We should then move the info needed by displayMultiple from ExtendedEntityState to EntityState and only call GetEntityState in that new loop.
- If it happens that everything is now needed, then the distinction between EntityState and GetEntityState would have no more meaning, and they should be merged (that would simplify a bit the code, and avoid some now useless steps).
- And maybe a way to improve performances when a lot of selected units would be to call the GuiInterface GetEntityState for an array of entities, such that all the selected units would need only one call instead of one per entity.
Change History (11)
comment:1 by , 7 years ago
Keywords: | simple added |
---|---|
Summary: | Increase in "gui sim update" timing after r18773 → Improve unit selection performance by rearranging GetEntityState following r18773 |
comment:2 by , 7 years ago
Cc: | added |
---|
comment:3 by , 7 years ago
comment:4 by , 7 years ago
In fact, we add the prices in the barketMarket ExtendedEntityState while this is useless as the prices are global and already in the SimulationState. barterMarket could become a simple bool property instead of the current object, and moved to EntityState.
comment:5 by , 7 years ago
Description: | modified (diff) |
---|
comment:6 by , 7 years ago
hum yes, it seems that the first commit adding them was r18733, a few days before 18773
comment:7 by , 6 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:8 by , 6 years ago
Investigating further, it seems like nearly everything (of extended and non-extended entState) is now needed everytime.
Edit: Requesting an array of entityStates has a performance benefit of about 20% (before caching).
comment:9 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:10 by , 6 years ago
Patch: | → Phab:D1223 |
---|
comment:11 by , 6 years ago
Keywords: | simple removed |
---|---|
Milestone: | Backlog → Alpha 23 |
Resolution: | → fixed |
Status: | new → closed |
Fixed by r20875 corresponding to phab:D1223
At the first glance it seems like only
barterMarket
is needed fromGetExtendedEntityState