Commit b7821696 authored by Daniel Silverstone's avatar Daniel Silverstone
Browse files

_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: default avatarDaniel Silverstone <daniel.silverstone@codethink.co.uk>
parent 0e471144
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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))