-
Notifications
You must be signed in to change notification settings - Fork 4
Unnecessary invalidation of event model caches #12
Description
Original report by Philipp Reinkemeier (Bitbucket: preinkemeier, GitHub: preinkemeier).
In the function _invalidate_event_model_caches(task) in file analysis.py, the event model caches of task are invalidated along with the event model caches of all its reachable successor tasks. This function is only called by the function _propagate(task, task_results) defined in the same file. That function is turn is used during initialization of the class GlobalAnalysisState and the central function analyze_system(system, task_results=None, only_dependent_tasks=False, progress_hook=None).
In both cases, there is no need to invalidate the caches of the input event model of the task the function _propagate is called with: The jitter and busy times of task have changed, so its output (!) event model has changed and therefore the input event models of all its direct and indirect successor tasks.
The following version of the function _invalidate_event_model_caches(task) would fix that:
def _invalidate_event_model_caches(task):
""" Invalidate all event model caches """
for t in util.breadth_first_search(task):
if not ( t is task ):
t.invalidate_event_model_cache()
Note that the set returned by util.breadth_first_search(task) also contains task, thus it must be filtered out. One could also change that function to NOT include the argument task in its resulting set, but since that function is used at some different places, i do not know whether this would break anything.