From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EKtsFFFJoWWjFgAAkFu2QA (envelope-from ) for ; Fri, 12 Jan 2024 15:14:41 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id uKf9EFFJoWVfvgAA62LTzQ (envelope-from ) for ; Fri, 12 Jan 2024 15:14:41 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=SAFb1+cT; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1705068881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=SxuXzKc5P8PsutD3J3SVD96Wo9cxqDPf4RTO1OOEG6U=; b=Prd94ALLtk6nzfvnhtZ1KgJCu8Nb6t9JuhaZXojZmD9HOSUHCIWR+hhkMRZkswaxmfBGIE la9dnNnh8eH1Q2ZNjROvCONAaIyc0XJzWrHM16UKigEyt2CMDjbyp+RQ1UzQe2vLIQ6mex Ldt3rrx+tGtAiUYgxuoy3JyBATNsTQjiXlGUQZQHs/gk1epc6EWNDRHCc/wbEI0hA4gKM5 1Q0DoJ6rtbYEhiyJaDfjwdCgyqOc2G7G1qJtRQoWrsjrl5WmsFuKrWgaADMhXPNgB3UaWt Z5aPwGBYbFg3ghO5zOgI+NTBz1ZzFNwMgNfnUQ+wToNGFSySVVG9UGIKuqOirA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=SAFb1+cT; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1705068881; a=rsa-sha256; cv=none; b=nUkJuG1mWc78vOrByXzYemm8Fw50huVWkGK1Y47QcySPxM8RVcBwVYpV+ILBrD4TTS0ZPX HHfWqN5hplM3Rh84C0hiq4EhY5/5eWdjyojYeTU/0aQcs6AdSNG0fic9Ukicy9aIAm3LWW rv08uXBhMQjc9DYfur2tAG06LCxagMpVrWQzSJW/gZ7adQuhnSHzPuVF+4s3CmR8plufIn prtNvuCEuvF3l73dNio/chMS0acHGadPJq7NZistkT/nS0mUjbK31pyedFd0Thtc8QH9dW 81WyOW7g70IM6my4GkEcOLUB0N+C6ITmBwvB7zU3cW8Bx8XBHU3I+k/Qs94f3A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0DEE3145BF for ; Fri, 12 Jan 2024 15:14:41 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOIIS-0005v3-3z; Fri, 12 Jan 2024 09:14:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOIIP-0005uQ-Bx for guix-patches@gnu.org; Fri, 12 Jan 2024 09:14:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOIIO-0003OW-UL for guix-patches@gnu.org; Fri, 12 Jan 2024 09:14:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rOIIM-00032J-Sr for guix-patches@gnu.org; Fri, 12 Jan 2024 09:14:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 7/7] packages: rust: Memoize make-rust-sysroot results. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 12 Jan 2024 14:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: Efraim Flashner , 68266@debbugs.gnu.org Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170506880411593 (code B ref 68266); Fri, 12 Jan 2024 14:14:02 +0000 Received: (at 68266) by debbugs.gnu.org; 12 Jan 2024 14:13:24 +0000 Received: from localhost ([127.0.0.1]:35248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOIHj-00030u-PV for submit@debbugs.gnu.org; Fri, 12 Jan 2024 09:13:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOIHg-00030I-Mw for 68266@debbugs.gnu.org; Fri, 12 Jan 2024 09:13:21 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOIHc-00038Q-7u; Fri, 12 Jan 2024 09:13:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=SxuXzKc5P8PsutD3J3SVD96Wo9cxqDPf4RTO1OOEG6U=; b=SAFb1+cTeU8K+Ylp2gRP OEjFOg+Urz1fhe2KUK48YOt4Yu6bTyGNUm4+kY54pwtwNBovQta+uWvKXPMD0FM9ahDNZqnHL8/pp hVzUFRloMAybd40Xutbh4cfKkOFGxySBMbChzsmVjVKskA+IqbkLdKidjmaJ/BdTEsYZ1J/Ak8fpz 2NwIb30X/orFyrbU0hj+xB0IDtG7W3sVDhJbLzJfpa8dFNuL9vKyUR9uc0MKrERmolfp9RfWq6ZP5 L5bcXzfYUuvL+5bSuVvCedZVLeYbSX1sld9QAIz9T9CnaLUbY7OlArOW8a1ArduggGXTC1quioBwa Z6YOtZ6DYbS/FQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (Christopher Baines's message of "Fri, 5 Jan 2024 16:40:49 +0000") References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> Date: Fri, 12 Jan 2024 15:13:12 +0100 Message-ID: <878r4uk5c7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -7.39 X-Migadu-Queue-Id: 0DEE3145BF X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -7.39 X-TUID: isuZoVGwVgFB --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Christopher Baines skribis: > To ensure that it just returns a single package record for some given > arguments, as this helps to avoid poor performance of the store connection > object cache. > > * gnu/packages/rust.scm (make-rust-sysroot): Move code to > make-rust-sysroot/implementation. > (make-rust-sysroot/implementation): New variable. > > Change-Id: Ibb30c7398328c87c032bb8828635a34ada935167 [...] > (define*-public (make-rust-sysroot target) > - (let ((base-rust rust)) > + (make-rust-sysroot/implementation target rust)) > + > +(define make-rust-sysroot/implementation > + (mlambda (target base-rust) > (package > (inherit base-rust) > (name (string-append "rust-sysroot-for-" target)) We should avoid using =E2=80=98mlambda=E2=80=99 (without =E2=80=98q=E2=80= =99) with packages as it leads to deep object comparisons. That=E2=80=99s why for packages we typically always have one-argument (mlambdaq (package) =E2=80=A6). But since =E2=80=98base-rust=E2=80=99 wasn=E2=80=99t a parameter before, le= t=E2=80=99s keep it simple (=E2=80=98diff --ignore-space-change=E2=80=99): --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 2b86cf3c8b..983a3f0f41 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -62,6 +62,7 @@ (define-module (gnu packages rust) #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix memoization) #:use-module (guix packages) #:use-module ((guix build utils) #:select (alist-replace)) #:use-module (guix utils) @@ -1060,7 +1061,8 @@ (define-public rust `("procps" ,procps) (package-native-inputs base-rust)))))) -(define*-public (make-rust-sysroot target) +(define-public make-rust-sysroot + (mlambda (target) (let ((base-rust rust)) (package (inherit base-rust) @@ -1228,7 +1230,7 @@ (define*-public (make-rust-sysroot target) (cross-binutils target))))) (properties `((hidden? . #t) - ,(package-properties base-rust)))))) + ,(package-properties base-rust))))))) (define-public rust-analyzer (package --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable It should help when cross-compiling several =E2=80=98cargo-build-system=E2= =80=99 packages: --8<---------------cut here---------------start------------->8--- $ time GUIX_PROFILING=3Dobject-cache guix build --no-grafts greetd wlgreet = du-dust circtools --target=3Daarch64-linux-gnu -d # before /gnu/store/mivzv83wryv9gp5bjncg5m1831dx2xwr-circtools-1.0.0.drv /gnu/store/4xf7kh9mi0vpvs8m1ak4x8w1rpsdpv6z-du-dust-0.8.6.drv /gnu/store/ayk54gvlbc1qam6irzf9kaig56dhzni0-wlgreet-0.4.1.drv /gnu/store/r601i40cii9ic5w1k4hy5c2yngfayh64-greetd-0.9.0.drv Object Cache: fresh caches: 22 lookups: 40435 hits: 36821 (91.1%) cache size: 3613 entries real 0m2.964s user 0m2.925s sys 0m0.174s $ time GUIX_PROFILING=3Dobject-cache ./pre-inst-env guix build --no-grafts = greetd wlgreet du-dust circtools --target=3Daarch64-linux-gnu -d # after /gnu/store/1wsldmvigjb8w2gk418npbnfznlb0ck1-circtools-1.0.0.drv /gnu/store/b5c73fawjdvkgy431qxz9l6l9y9a9lhz-du-dust-0.8.6.drv /gnu/store/zwc7qzsbzf62dgbbzy74lki4hsr406bw-wlgreet-0.4.1.drv /gnu/store/vjdd23hc82701afb132z1ajcqa7hfd74-greetd-0.9.0.drv Object Cache: fresh caches: 22 lookups: 37942 hits: 34523 (91.0%) cache size: 3418 entries real 0m2.980s user 0m3.300s sys 0m0.160s --8<---------------cut here---------------end--------------->8--- (Here we removed ~2.5k nodes from the cache.) WDYT? Ludo=E2=80=99. --=-=-=--