Cache top of stack for efficiency

Otherwise you need to retrieve this container for every key again. Doesn't matter much, but a bit.

Contributes to issue CURA-4186.
This commit is contained in:
Ghostkeeper 2017-08-18 15:36:15 +02:00
parent 4a788dfbdd
commit 3c36c3427c
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -310,9 +310,10 @@ class StartSliceJob(Job):
return
# Check all settings for relations, so we can also calculate the correct values for dependent settings.
changed_setting_keys = set(stack.getTop().getAllKeys())
for key in stack.getTop().getAllKeys():
instance = stack.getTop().getInstance(key)
top_of_stack = stack.getTop() #Cache for efficiency.
changed_setting_keys = set(top_of_stack.getAllKeys())
for key in top_of_stack.getAllKeys():
instance = top_of_stack.getInstance(key)
self._addRelations(changed_setting_keys, instance.definition.relations)
Job.yieldThread()