From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1461315-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 5FA2D158020
	for <garchives@archives.gentoo.org>; Mon, 28 Nov 2022 15:33:02 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 60BECE089C;
	Mon, 28 Nov 2022 15:33:00 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 4BF1CE089C
	for <gentoo-commits@lists.gentoo.org>; Mon, 28 Nov 2022 15:33:00 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 29A40340F5F
	for <gentoo-commits@lists.gentoo.org>; Mon, 28 Nov 2022 15:32:59 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 59B75763
	for <gentoo-commits@lists.gentoo.org>; Mon, 28 Nov 2022 15:32:57 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <1669595861.839ab46be1777e5886da28b98b53a462b992c5bf.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/_emerge/depgraph.py
X-VCS-Directories: lib/_emerge/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 839ab46be1777e5886da28b98b53a462b992c5bf
X-VCS-Branch: master
Date: Mon, 28 Nov 2022 15:32:57 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 7f6b774f-c742-473f-ad99-005b07640e11
X-Archives-Hash: fada2895f6e9f733dced5365f9053ae6

commit:     839ab46be1777e5886da28b98b53a462b992c5bf
Author:     Pin-yen Lin <treapking <AT> chromium <DOT> org>
AuthorDate: Fri Nov 25 03:36:27 2022 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Nov 28 00:37:41 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=839ab46b

Add caching to _slot_operator_check_reverse_dependencies

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.

Bug: https://bugs.gentoo.org/883071
Signed-off-by: Pin-yen Lin <treapking <AT> chromium.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/_emerge/depgraph.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index bb0824324..d0ea92ad9 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
     ):