summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-11-06 09:58:25 +0000
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-02-12 15:12:30 +0000
commita39c476711c875b87d10e0a8799c6d9a9973e5ce (patch)
treeeb76df1528725facc15430098bf9d62cdff64185
parent95d9b9ae5cc2807959390be355be339ef151a524 (diff)
downloadbuildstream-a39c476711c875b87d10e0a8799c6d9a9973e5ce.tar.gz
_yaml.py: Only retrieve provenance in node_get() when needed
We were indiscriminately retrieving the node's provenance data in the `node_get()` function which was accounting for approximately a third of the total runtime of `node_get()` which dominates pre-scheduler time in `bst build`. This change ameliorates that situation by only retrieving the provenance data when it's actually needed. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/_yaml.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py
index 753254e6a..d0fb502f5 100644
--- a/buildstream/_yaml.py
+++ b/buildstream/_yaml.py
@@ -365,8 +365,8 @@ _sentinel = object()
#
def node_get(node, expected_type, key, indices=None, *, default_value=_sentinel, allow_none=False):
value = node.get(key, default_value)
- provenance = node_get_provenance(node)
if value is _sentinel:
+ provenance = node_get_provenance(node)
raise LoadError(LoadErrorReason.INVALID_DATA,
"{}: Dictionary did not contain expected key '{}'".format(provenance, key))