Skip to content

_loader/loadelement.py: Use enumerate() in dependency extraction

Description

In _loader/loadelement.py::_extract_depends_from_node() there was an n-squared issue where we scanned a list of dependencies. In normal use-cases this doesn't show as a problem, but as the dependency list of a node increases in size, this can cause issues. If you have a build_all.bst situation where it depends on every other element relevant to a system, you can end up with thousands, or even a few tens of thousands, of dependencies. One such element in a plan can result in tens of seconds wasted linear-searching lists.

Changes proposed in this merge request:

  • Use enumerate() rather than a plain list iteration followed by list.index() in the body.

This merge request, when approved, will improve matters for: #466 (closed)


Merge request reports

Loading