summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-05 22:18:09 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-07 12:07:02 +0100
commit8b6354ee7d3473041f64d79b2a7181f00073a90b (patch)
tree42b869442c9c6cc8313a20cf5e5c97aa458ec87a
parent1ac4844b477d1b19ae959df2f51c68b30130522f (diff)
downloadbuildstream-bschubert/optimize-extract-depends-node.tar.gz
_loader/types: Use range() instead of enumerate in extract_depends_from_nodebschubert/optimize-extract-depends-node
range() and access to the list can be optimized better by cython than the enumerate() call.
-rw-r--r--src/buildstream/_loader/types.pyx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buildstream/_loader/types.pyx b/src/buildstream/_loader/types.pyx
index 59352d68d..da33d6c54 100644
--- a/src/buildstream/_loader/types.pyx
+++ b/src/buildstream/_loader/types.pyx
@@ -142,11 +142,11 @@ cdef void _extract_depends_from_node(_yaml.Node node, str key, str default_dep_t
cdef int index
cdef _yaml.ProvenanceInformation dep_provenance
- for index, dep in enumerate(depends):
+ for index in range(len(depends)):
# FIXME: the provenance information would be obtainable from the Node directly if we stop
# stripping provenance and have proper nodes for str elements
dep_provenance = <_yaml.ProvenanceInformation> _yaml.node_get_provenance(node, key=key, indices=[index])
- dependency = Dependency(dep, dep_provenance, default_dep_type=default_dep_type)
+ dependency = Dependency(depends[index], dep_provenance, default_dep_type=default_dep_type)
acc.append(dependency)
# Now delete the field, we dont want it anymore