spec performance: don't parse in from_node_dict
Constructing a spec from a name instead of setting name directly forces from_node_dict to call Spec.parse(), which is slow. Avoid this by using a zero-arg constructor and setting name directly.
This commit is contained in:
parent
2fbc8caf86
commit
6fe931ccb1
@ -1786,10 +1786,12 @@ def from_node_dict(node):
|
|||||||
name = next(iter(node))
|
name = next(iter(node))
|
||||||
node = node[name]
|
node = node[name]
|
||||||
|
|
||||||
spec = Spec(name, full_hash=node.get('full_hash', None))
|
spec = Spec()
|
||||||
|
spec.name = name
|
||||||
spec.namespace = node.get('namespace', None)
|
spec.namespace = node.get('namespace', None)
|
||||||
spec._hash = node.get('hash', None)
|
spec._hash = node.get('hash', None)
|
||||||
spec._build_hash = node.get('build_hash', None)
|
spec._build_hash = node.get('build_hash', None)
|
||||||
|
spec._full_hash = node.get('full_hash', None)
|
||||||
|
|
||||||
if 'version' in node or 'versions' in node:
|
if 'version' in node or 'versions' in node:
|
||||||
spec.versions = vn.VersionList.from_dict(node)
|
spec.versions = vn.VersionList.from_dict(node)
|
||||||
|
Loading…
Reference in New Issue
Block a user