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 +IOmD5LSnWWMFgEAkFu2QA (envelope-from ) for ; Wed, 10 Jan 2024 00:11:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id OC6ZCpLSnWVLQwEA62LTzQ (envelope-from ) for ; Wed, 10 Jan 2024 00:11:14 +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=TDGRJxbP; 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=1704841874; 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=CldhrM5j3uJvBBy8LZ4aN5RSUGHm8zBlvU0kfDe8qjo=; b=eS3SjtMRJkSk3vkvbJzXOlWHfm9w8oZoph+OnD3Y40dp0MRNQviomX7PqH9rJwdBd8lkIy v3MH31p/12aGwVmgAiuBct8oYRMMxgwnMeN/t2NWs1h9j1ozADaj6aYUc5WYrPehZyflLg RHfGy0O/vG7ajbDqPOzJB0iSTOTEBYm+bgVLFrFNCIMvz1XriMAPveI1D30XqfPLPHP4Av 5fWzF1mxTjipMO7MaY3rP2Ofjjh9B96kOvmwlzZXbScnpdRRY5HaCeGgUJt+uvk8n/Hewz TYOaY7jXPH8AilrQN6RbZW3iX8rxTD3zdetJGG311dYxRg9a/staUoly8ZUHkQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704841874; a=rsa-sha256; cv=none; b=TEwav03J6fS1Da37ph6SCaXT3kk1oMesYpJ9N/uMWP43RKmw1DEE2Sclr920iSA+YR5r9F ggLzVmaphJP1TEWNoSYCWnejG8Lz+E88yzB9lyub8NUDeuoFyLqMytBBbXz38Pwn/1xlGb IJRwjSjTkU12sXdedFZC+VJREF4lPjNEf7BvidrjG0S+vXEkxPnfJcup3mfm2MkLxm2T70 Xn6aOITQqnlhAhzltF44JfA3PhFKLDVMP9rJ6tMDfseM3X7rKYAOtc7QwjlFcNrGEiJuKd EPz0YwyEihxVlNn6nqxP3Q6apwv9QObz+Si4VHrOc6a9KwdhDKIJRoTw+6wnOQ== 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=TDGRJxbP; 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 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 C26C06DE1F for ; Wed, 10 Jan 2024 00:11:13 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNLFM-0007e5-8v; Tue, 09 Jan 2024 18:11:00 -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 1rNLFI-0007bs-D7 for guix-patches@gnu.org; Tue, 09 Jan 2024 18:10:57 -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 1rNLFH-0007lL-5O for guix-patches@gnu.org; Tue, 09 Jan 2024 18:10:56 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNLFN-0006TL-W3 for guix-patches@gnu.org; Tue, 09 Jan 2024 18:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 1/7] gnu: Memozise make-ld-wrapper results. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Jan 2024 23:11:01 +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: 68266@debbugs.gnu.org Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170484182424831 (code B ref 68266); Tue, 09 Jan 2024 23:11:01 +0000 Received: (at 68266) by debbugs.gnu.org; 9 Jan 2024 23:10:24 +0000 Received: from localhost ([127.0.0.1]:41254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNLEl-0006SR-QP for submit@debbugs.gnu.org; Tue, 09 Jan 2024 18:10:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNLEk-0006SD-83 for 68266@debbugs.gnu.org; Tue, 09 Jan 2024 18:10:22 -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 1rNLEX-0007Pv-KA; Tue, 09 Jan 2024 18:10:09 -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=CldhrM5j3uJvBBy8LZ4aN5RSUGHm8zBlvU0kfDe8qjo=; b=TDGRJxbPqrxASc2w9Uql 6VnSimOw7zW2ObokeHOu6KpfFAb8I1tuVqdcKKvdrZ2UYJ0OEVTpol94kR/sCFxnisDqxbg08k5wk pS9twliHkK2UC3EDzsEzn2/UHPUeXNNtv/1K/Py1uLMdutyFQPzsb926GwH14cigCND4PQpgFjk0u izF7M86JFLkubU7yH6GMVcAnhf14HQWIRXtPt2S7G1PNydbj4tzvXL5QQSiZItJF+AdUWgEKgeBM3 +69JGS4A3A4VJzEVLKvHYyzcpFhB7vfP2Sn+PdzwFsi8BCfQ5sXxmDwSiRGLZaIWhbv19osRAtJoy rGc8+hEn53U3Hw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <878r4zr6a0.fsf@cbaines.net> (Christopher Baines's message of "Mon, 08 Jan 2024 19:01:58 +0000") References: <87plyfrb2x.fsf@cbaines.net> <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> <87v8833fl7.fsf@gnu.org> <878r4zr6a0.fsf@cbaines.net> Date: Wed, 10 Jan 2024 00:10:04 +0100 Message-ID: <87plyaw1bn.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-Migadu-Queue-Id: C26C06DE1F X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -5.51 X-Spam-Score: -5.51 X-TUID: cARDazUk9ZS4 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Christopher Baines skribis: > I believe the reason packages from make-ld-wrapper were showing up > multiple times in the cache for me is linked to it's use in the > cross-base module, as part of the cross-gcc procedure. > > A later commit does change cross-gcc to return a single package record > for some given arguments, so that probably resolves the biggest misuse > of make-ld-wrapper. Oh, I see. Before resorting to memoization (which doesn=E2=80=99t come for free), we c= an for instance make sure we do not create new package records from inputs fields (since they are thunked, a fresh record would be created each time the field is accessed). Here=E2=80=99s an example: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 6ee7b315d8..ca3b41a4c7 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -306,6 +306,11 @@ (define* (cross-gcc target XGCC as the base compiler. Use XBINUTILS as the associated cross-Binutils. If LIBC is false, then build a GCC that does not target a libc; otherwise, target that libc." + (define ld-wrapper + (make-ld-wrapper (string-append "ld-wrapper-" target) + #:target (const target) + #:binutils xbinutils)) + (package (inherit xgcc) (name (string-append "gcc-cross-" @@ -313,8 +318,7 @@ (define* (cross-gcc target target)) (source (origin - (inherit - (package-source xgcc)) + (inherit (package-source xgcc)) (patches (append (origin-patches (package-source xgcc)) @@ -353,10 +357,7 @@ (define* (cross-gcc target ,@(cross-gcc-arguments target xgcc libc))) (native-inputs - `(("ld-wrapper-cross" ,(make-ld-wrapper - (string-append "ld-wrapper-" target) - #:target (const target) - #:binutils xbinutils)) + `(("ld-wrapper-cross" ,ld-wrapper) ("binutils-cross" ,xbinutils) ,@(let ((inputs (append (package-inputs xgcc) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This particular one doesn=E2=80=99t have a huge impact on simple cases but = it might pay off for bigger graphs: --8<---------------cut here---------------start------------->8--- $ GUIX_PROFILING=3Dobject-cache ./pre-inst-env guix build hello --target=3D= aarch64-linux-gnu --no-grafts -d /gnu/store/i8x1gg73x3fvxn4lrrgbcb97sz4qq1yx-hello-2.12.1.drv Object Cache: fresh caches: 20 lookups: 5514 hits: 5008 (90.8%) cache size: 505 entries $ # before: $ GUIX_PROFILING=3Dobject-cache ./pre-inst-env guix build hello --target=3D= aarch64-linux-gnu --no-grafts -d /gnu/store/kdnh9bwg874aq8bvvw9y2vkl7z94icqa-hello-2.12.1.drv Object Cache: fresh caches: 20 lookups: 5406 hits: 4907 (90.8%) cache size: 498 entries --8<---------------cut here---------------end--------------->8--- > I think there's other cases (in the llvm and mold modules) where it > looks like it's called multiple times with the same arguments, so maybe > that's an argument for having memoization around make-ld-wrapper even > though it's not needed for all uses. On guix-devel, Efraim mentioned cargo-build-system packages. Is that related? Thanks for looking into this! Ludo=E2=80=99. --=-=-=--