From 52490144d35a624be56c113ea80f584471596252 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 2 Jul 2019 14:42:03 +0300 Subject: [PATCH] Move some processing from intermediate method to final method to save resources when we need dps/volley, not damage --- gui/builtinGraphs/fitDamageStats.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gui/builtinGraphs/fitDamageStats.py b/gui/builtinGraphs/fitDamageStats.py index c89760783..55ed7c58c 100644 --- a/gui/builtinGraphs/fitDamageStats.py +++ b/gui/builtinGraphs/fitDamageStats.py @@ -229,7 +229,11 @@ class FitDamageStatsGraph(FitGraph): for time in sorted(changesMap): timeDmgData = copy(timeDmgData) for key in changesMap[time]: - timeDmgData[key] = intCache[key][time] + keyDmg = intCache[key][time] + if key in timeDmgData: + timeDmgData[key] = timeDmgData[key] + keyDmg + else: + timeDmgData[key] = keyDmg finalCache[time] = timeDmgData # We do not need intermediate cache once we have final del timeCache['intermediateDmg'] @@ -257,14 +261,7 @@ class FitDamageStatsGraph(FitGraph): def addDmg(ddKey, addedTime, addedDmg): if addedDmg.total == 0: return - ddCache = intCacheDmg.setdefault(ddKey, {}) - try: - maxTime = max(ddCache) - except ValueError: - ddCache[addedTime] = addedDmg - return - prevDmg = ddCache[maxTime] - ddCache[addedTime] = prevDmg + addedDmg + intCacheDmg.setdefault(ddKey, {})[addedTime] = addedDmg # Modules for mod in fit.modules: