summaryrefslogtreecommitdiff
path: root/apt-pkg/solver3.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-08-13 11:47:06 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-11-02 10:23:15 +0100
commit88cad6148797c399764333fbae3ade3036eb7dc3 (patch)
tree37e08dd548779db3303ed22037a4505fc414d937 /apt-pkg/solver3.cc
parent9d99322c14c44d73722bd580473abf67538b7c05 (diff)
Add a FIXME around the heap compaction
Our work heap is currently cleaned from deeper levels by removing the entries from the heap and then remaking the heap which is very inefficient. We should mark the items as erased instead, and only do the remove & make_heap dance if we have a lot of erased entries in there. Possibly we maybe should use a structure that actually allows removing entries, that is, an std::set, but that warrants more investigation on performance aspects.
Diffstat (limited to 'apt-pkg/solver3.cc')
-rw-r--r--apt-pkg/solver3.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 7aa0bd0b2..328c52f99 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -766,6 +766,8 @@ bool APT::Solver::Pop()
UndoOne();
// We need to remove any work that is at a higher depth.
+ // FIXME: We should just mark the entries as erased and only do a compaction
+ // of the heap once we have a lot of erased entries in it.
choices.pop_back();
work.erase(std::remove_if(work.begin(), work.end(), [this](Work &w) -> bool
{ return w.depth > depth() || w.erased; }),