From 8f98a54af5e99525a9d2436b8ff49ab23d9dfdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 27 May 2025 12:49:30 +0200 Subject: [PATCH] Skip manifest loading if there are no components/targets to check --- src/toolchain/distributable.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 48b3dd2b00..a1787f4faa 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -134,6 +134,12 @@ impl<'a> DistributableToolchain<'a> { components: &[&str], targets: &[&str], ) -> anyhow::Result { + // Performance optimization: avoid loading the manifest (which can be expensive) + // if there are no components/targets to check. + if components.is_empty() && targets.is_empty() { + return Ok(true); + } + let manifestation = self.get_manifestation()?; let manifest = manifestation.load_manifest()?; let manifest = match manifest {