while trying to find a fix for bug 917660, we found that find_smallest_cycle can be optimized to traverse fewer nodes. On my laptop, this optimization brings the emerge -pe @world time down to 3m28.884s, compared to 10m44.268s with portage-3.0.55.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=49e01d041c74680a81860b819daff812d83df02f commit 49e01d041c74680a81860b819daff812d83df02f Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2023-11-28 03:42:17 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2023-11-28 03:42:17 +0000 find_smallest_cycle: Optimize to traverse fewer nodes If gather_deps is traversing a cycle that is greater than or equal to the size of the current smallest_cycle, then abort early. Also abort early if we traverse a node encountered in a previous cycle for the same ignore_priority, since that means the two cycles are identical. On my laptop, this brings the emerge -pe @world time down to 3m28.884s, compared to 10m44.268s with portage-3.0.55. Bug: https://bugs.gentoo.org/918682 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/_emerge/depgraph.py | 36 ++++++++++++++++++++-- .../tests/resolver/test_rebuild_ghostscript.py | 2 +- .../resolver/test_runtime_cycle_merge_order.py | 7 +++-- 3 files changed, 39 insertions(+), 6 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=baec60737ddc370dcf77ce1c797ff187357c4b14 commit baec60737ddc370dcf77ce1c797ff187357c4b14 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-12-01 02:54:12 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-12-01 02:54:29 +0000 sys-apps/portage: add 3.0.56 Closes: https://bugs.gentoo.org/760893 Closes: https://bugs.gentoo.org/917033 Closes: https://bugs.gentoo.org/917259 Closes: https://bugs.gentoo.org/917315 Closes: https://bugs.gentoo.org/918515 Closes: https://bugs.gentoo.org/918682 Closes: https://bugs.gentoo.org/918683 Closes: https://bugs.gentoo.org/916977 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.56.ebuild | 238 +++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+)
We've reverted this optimization because it triggered bug 922629, but we can try again to optimize it without breaking testTarMergeOrder.