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 CBAE0158020 for ; Fri, 25 Nov 2022 03:36:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E67EEE0965; Fri, 25 Nov 2022 03:36:39 +0000 (UTC) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 DE34CE0965 for ; Fri, 25 Nov 2022 03:36:39 +0000 (UTC) Received: by mail-pf1-x42f.google.com with SMTP id c21so1144696pfb.10 for ; Thu, 24 Nov 2022 19:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=74z/nft7UfruuMYtUehwnEjTXqLEUsehSQ34XMx5ovs=; b=l887/yfCPHphFzlpQxtoEwL80IaRyFtgh6oVKJ6HALY0Vsvg3/9+d6Gc3mmcp6BW4L 9pTvjCgcwiuCXX7WAEzi0nYeZh/kFXH7d0eq+OBsevcZc1092W6aIyQm1P4wEKkRUW6u V1yH79WboRn4jbqoHlggkowvB75xmaulMlTaI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=74z/nft7UfruuMYtUehwnEjTXqLEUsehSQ34XMx5ovs=; b=0KNkbirl0IUdCy0mvMTFEj8Eo5QZMJ5/4Max9AaSGNJnr5eKsQFqQ7M6/EFwTjVaIw ycNA0jGR8MrTKuaaIG19JNZvDWyb1J4dqDSwyykWmUlV2WmhC/PnyBy7ChqzC5rPqzoQ M49hx61I2VZbBqxKd6LHQwmRWrq5qKfRy29YYg52Onjw+b6VU8JDRIKiXu64OZZYFtwx rXeBQtk6QrTchr7Bgh7pRVJzQGTdzuhuzlvi5Rr/DVSxHn0kNlbasyOrUAgIFj/iOjdY dKrVZ2vWaw02Zf+fK4/qA5XZBjA9w3EvRmvqMUs1pWja4bRiFYUt0p/PQYV9RYA9a6qE qbbQ== X-Gm-Message-State: ANoB5plSjHxajlKsuVmUhV+pxw6SOUsc+y3mY4ZBJULrAa79mX+jVrLI 9ao2v2YqCQUI519yCL4gYu67NRN9dqElVA== X-Google-Smtp-Source: AA0mqf4No+dcQFvFibjIYIHIlnSVMmt9wB1rmGfdUYAJ1Q1WARueSkUziUQyIg3+s+RgiQxSjm9o5A== X-Received: by 2002:a63:cf0e:0:b0:477:b603:f754 with SMTP id j14-20020a63cf0e000000b00477b603f754mr10900689pgg.232.1669347398628; Thu, 24 Nov 2022 19:36:38 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:5d98:6fda:de11:3c9]) by smtp.gmail.com with ESMTPSA id 22-20020a621616000000b0053e468a78a8sm1937037pfw.158.2022.11.24.19.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 19:36:38 -0800 (PST) From: Pin-yen Lin To: gentoo-portage-dev@lists.gentoo.org Cc: Pin-yen Lin Subject: [gentoo-portage-dev] [PATCH 2/2] Add caching to _slot_operator_check_reverse_dependencies Date: Fri, 25 Nov 2022 11:36:27 +0800 Message-Id: <20221125033627.1105638-2-treapking@chromium.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221125033627.1105638-1-treapking@chromium.org> References: <20221125033627.1105638-1-treapking@chromium.org> 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 Content-Transfer-Encoding: 8bit X-Archives-Salt: 9274334b-e841-4fe6-8c1f-8d2bb3a8b927 X-Archives-Hash: bdcf3c2d85fc5267c58ed2c3fa7a6128 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 ): -- 2.38.1.584.g0f3c55d4c2-goog