From: Pin-yen Lin <treapking@chromium.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Pin-yen Lin <treapking@chromium.org>
Subject: [gentoo-portage-dev] [PATCH 2/2] Add caching to _slot_operator_check_reverse_dependencies
Date: Fri, 25 Nov 2022 11:36:27 +0800 [thread overview]
Message-ID: <20221125033627.1105638-2-treapking@chromium.org> (raw)
In-Reply-To: <20221125033627.1105638-1-treapking@chromium.org>
Add lru_cache to speed up the running time of "Calculating
dependencies".
In a ChromeOS use case, this patch decreases the running time from
311s to 197s with almost no memory usage increase.
Signed-off-by: Pin-yen Lin <treapking@chromium.org>
---
lib/_emerge/depgraph.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index ce6cabcc1..9649bb2a8 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -2240,6 +2240,7 @@ class depgraph:
return None
+ @functools.lru_cache(maxsize=100)
def _slot_operator_check_reverse_dependencies(
self, existing_pkg, candidate_pkg, replacement_parent=None
):
--
2.38.1.584.g0f3c55d4c2-goog
next prev parent reply other threads:[~2022-11-25 3:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 3:36 [gentoo-portage-dev] [PATCH 1/2] Move and rename check_reverse_dependencies Pin-yen Lin
2022-11-25 3:36 ` Pin-yen Lin [this message]
2022-11-25 17:08 ` [gentoo-portage-dev] [PATCH 2/2] Add caching to _slot_operator_check_reverse_dependencies Matt Turner
2022-11-28 15:47 ` Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221125033627.1105638-2-treapking@chromium.org \
--to=treapking@chromium.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox