Use __slots__ for dependencies.Node
The number of nodes in the dependency graph is not huge (one per resource), but we tend to make a lot of copies - the whole graph must be copied every time we iterate through it. Since the Node class has only two attributes and is basically never modified, we can easily save a little memory by defining __slots__ for it. Change-Id: Ibe36016a5889c9f1bd89672b1b03b2bc69b7925b
This commit is contained in:
parent
da5ba93048
commit
c93e44dc1e
|
@ -30,6 +30,8 @@ class CircularDependencyException(exception.HeatException):
|
|||
class Node(object):
|
||||
"""A node in a dependency graph."""
|
||||
|
||||
__slots__ = ('require', 'satisfy')
|
||||
|
||||
def __init__(self, requires=None, required_by=None):
|
||||
"""Initialisation of the node.
|
||||
|
||||
|
|
Loading…
Reference in New Issue