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 08:43:33 +0000
commit4bf6c4e083efd8cef8a13a20d1d31af4829d2927 (patch)
tree523272fb42e22accf8c7c6ff17c07d9343668555
parent86a9048a587f67fbb562f1188f9d04db0c220f75 (diff)
downloadbuildstream-4bf6c4e083efd8cef8a13a20d1d31af4829d2927.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))