Portage code should avoid iterating over all repositories when possible. For example, this pull request implements of cache of catpkg to repository mappings in order to optimize iteration over repositories: https://github.com/gentoo/portage/pull/218
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=8b1f9dbd925ccf9c23909116c56eaa4d4f996474 commit 8b1f9dbd925ccf9c23909116c56eaa4d4f996474 Author: Daniel Robbins <drobbins@funtoo.org> AuthorDate: 2017-10-13 21:33:19 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2017-10-14 04:44:29 +0000 portdbapi: cache catpkg to repository mappings In order to avoid performance problems as the number of repositories increases, use a cache of catpkg to repository mappings to optimize findname2, cp_list, and getRepositories methods. Bug: https://bugs.gentoo.org/634210 Closes: https://github.com/gentoo/portage/pull/218 NEWS | 7 +++ RELEASE-NOTES | 6 +++ pym/_emerge/depgraph.py | 4 +- pym/portage/dbapi/porttree.py | 103 +++++++++++++++++++++++++++++++++++++----- 4 files changed, 107 insertions(+), 13 deletions(-)}