summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2023-11-06 17:00:37 -0800
committerGitHub <noreply@github.com>2023-11-07 01:00:37 +0000
commit910190f55bb5467305dd75a4dac8c60f1f51e283 (patch)
tree38d35cd1b434ee78b6df796cce3f16c3adab0ac1 /.github/workflows
parent4ce80b95f3cbb8b6e8ce6bb4546dee76b1f398dc (diff)
downloadspack-910190f55bb5467305dd75a4dac8c60f1f51e283.tar.gz
spack-910190f55bb5467305dd75a4dac8c60f1f51e283.tar.bz2
spack-910190f55bb5467305dd75a4dac8c60f1f51e283.tar.xz
spack-910190f55bb5467305dd75a4dac8c60f1f51e283.zip
database: optimize query() by skipping unnecessary virtual checks (#40898)
Most queries will end up calling `spec.satisfies(query)` on everything in the DB, which will cause Spack to ask whether the query spec is virtual if its name doesn't match the target spec's. This can be expensive, because it can cause Spack to check if any new virtuals showed up in *all* the packages it knows about. That can currently trigger thousands of `stat()` calls. We can avoid the virtual check for most successful queries if we consider that if there *is* a match by name, the query spec *can't* be virtual. This PR adds an optimization to the query loop to save any comparisons that would trigger a virtual check for last. - [x] Add a `deferred` list to the `query()` loop. - [x] First run through the `query()` loop *only* checks for name matches. - [x] Query loop now returns early if there's a name match, skipping most `satisfies()` calls. - [x] Second run through the `deferred()` list only runs if query spec is virtual. - [x] Fix up handling of concrete specs. - [x] Add test for querying virtuals in DB. - [x] Avoid allocating deferred if not necessary. --------- Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
Diffstat (limited to '.github/workflows')
0 files changed, 0 insertions, 0 deletions