From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 BA0CD158020 for ; Mon, 28 Nov 2022 15:47:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E5D47E08A0; Mon, 28 Nov 2022 15:47:27 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 C365AE08A0 for ; Mon, 28 Nov 2022 15:47:27 +0000 (UTC) Message-ID: <7d39c5e2-c08f-f7e9-31a0-9c6979d31428@gentoo.org> Date: Mon, 28 Nov 2022 07:47:25 -0800 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [gentoo-portage-dev] [PATCH 2/2] Add caching to _slot_operator_check_reverse_dependencies To: gentoo-portage-dev@lists.gentoo.org, Pin-yen Lin References: <20221125033627.1105638-1-treapking@chromium.org> <20221125033627.1105638-2-treapking@chromium.org> Content-Language: en-US From: Zac Medico In-Reply-To: <20221125033627.1105638-2-treapking@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: 670efcae-e9de-4866-8ff2-dae42bb5d25e X-Archives-Hash: 011c46ad4edc8382fea86a7666581ad5 On 11/24/22 19:36, Pin-yen Lin wrote: > 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 > --- > 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 > ): Merged. Thank you! https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c42cc962e1926ecbdc83d903a2804f9e037f2a9 https://gitweb.gentoo.org/proj/portage.git/commit/?id=839ab46be1777e5886da28b98b53a462b992c5bf -- Thanks, Zac