Use list instead of OrderedDict to find virtual/external candidates
- This reduces concretization time for r-rminer from over 1 minute to only 16 seconds. - OrderedDict ends up taking a *lot* of time to compare larger specs. - An OrderedDict isn't actually needed here. It's actually not possible to find duplicates, and we end up sorting the contents of the OrderedDict anyway.
This commit is contained in:
parent
f58c503091
commit
3f091fb6db
@ -37,7 +37,6 @@
|
|||||||
from six import iteritems
|
from six import iteritems
|
||||||
from spack.version import *
|
from spack.version import *
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from ordereddict_backport import OrderedDict
|
|
||||||
from functools_backport import reverse_order
|
from functools_backport import reverse_order
|
||||||
|
|
||||||
import spack
|
import spack
|
||||||
@ -80,17 +79,15 @@ def _valid_virtuals_and_externals(self, spec):
|
|||||||
# For each candidate package, if it has externals, add those
|
# For each candidate package, if it has externals, add those
|
||||||
# to the usable list. if it's not buildable, then *only* add
|
# to the usable list. if it's not buildable, then *only* add
|
||||||
# the externals.
|
# the externals.
|
||||||
#
|
usable = []
|
||||||
# Use an OrderedDict to avoid duplicates (use it like a set)
|
|
||||||
usable = OrderedDict()
|
|
||||||
for cspec in candidates:
|
for cspec in candidates:
|
||||||
if is_spec_buildable(cspec):
|
if is_spec_buildable(cspec):
|
||||||
usable[cspec] = True
|
usable.append(cspec)
|
||||||
|
|
||||||
externals = spec_externals(cspec)
|
externals = spec_externals(cspec)
|
||||||
for ext in externals:
|
for ext in externals:
|
||||||
if ext.satisfies(spec):
|
if ext.satisfies(spec):
|
||||||
usable[ext] = True
|
usable.append(ext)
|
||||||
|
|
||||||
# If nothing is in the usable list now, it's because we aren't
|
# If nothing is in the usable list now, it's because we aren't
|
||||||
# allowed to build anything.
|
# allowed to build anything.
|
||||||
|
Loading…
Reference in New Issue
Block a user