summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2026-02-09 11:42:26 +0100
committerJulian Andres Klode <jak@debian.org>2026-02-10 19:59:03 +0000
commita08f18e2a1b7e409d2d20d55749d378d4c21daa6 (patch)
tree0accb1fcb74a1b494857bf2e0b6ddb9babee75a5
parent27e845d53da7e1794eadeb93f4b6f591042ad20c (diff)
solver3: Cache straight pointers in candidate cache
This reduces its memory usage by half and turns it into a fast map - no destructors needed (and 0 initialization).
-rw-r--r--apt-pkg/solver3.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h
index fc2e90b7f..4390d589b 100644
--- a/apt-pkg/solver3.h
+++ b/apt-pkg/solver3.h
@@ -461,12 +461,12 @@ class DependencySolver final : public Solver
}
// GetCandidateVer() with caching
- mutable ContiguousCacheMap<pkgCache::Package, pkgCache::VerIterator> candidates;
+ mutable FastContiguousCacheMap<pkgCache::Package, pkgCache::Version *> candidates;
pkgCache::VerIterator GetCandidateVer(pkgCache::PkgIterator pkg) const
{
- if (candidates[pkg].end())
+ if (candidates[pkg] == 0)
candidates[pkg] = policy.GetCandidateVer(pkg);
- return candidates[pkg];
+ return pkgCache::VerIterator(cache, candidates[pkg]);
}
// \brief Discover variables