From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id +PXHMNQuVmXFeQAAG6o9tA:P1 (envelope-from ) for ; Thu, 16 Nov 2023 16:01:41 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id +PXHMNQuVmXFeQAAG6o9tA (envelope-from ) for ; Thu, 16 Nov 2023 16:01:40 +0100 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 A7ECE31A0B for ; Thu, 16 Nov 2023 16:01:40 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=EFFrVOn+; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1700146900; a=rsa-sha256; cv=none; b=rKFQv6EatENVv3X0iJpCG/Cr1T0Yk0PWxv0hPVMgIG7TFc75IBCowR5kk1U0QLbMglXXnh 4Pf1JaZF3glqcAq+0ZWe4Asid9f+3x0qntCPgygjeN8Rp/zDgnhLwL9DzohQ+Bc5IHuOoZ 7k724VX0r3UzlwDGKriViG4hxt1EzriUC4Qvl45mMpk+3+EHqiztOFacl0vnBUA9sDXtod k55KFxRX4TkcOImcSKECpbXp/HquRUlEDZ8/qMGz+ISvLh4WO0fqpAKjIRjvc1QFJV7VJ0 WUdbhY4PfI24jqKc0V6LaJbqpf2s7c3T4JU/HTM1w42ojWfU5iu0ZKh8OeRxtQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gnu.org header.s=fencepost-gnu-org header.b=EFFrVOn+; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1700146900; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=JRWsot3HC91PpTeN/F0asCTDHWgOHwzR2qWa4A1Bp3k=; b=U5hkDNBzIF7eMCKLkiXQOLJLIazWYDKHToDPWnW5tWpZzTBpLSY2jWOSUDd4NBt1CMvKY0 pfm4CHKIQlwjXzGqH9FPVdzpI+vlVxCJCH0/F9LgmLCkvihtvXu4WKkSjYV1BHYgtZyADG vUELQTqcwBX/iwoObjO6I8BS+tqqpnkJXuqzK69LbLk8UX8GnQGwrinhqVgrMHcBJp1na6 72luZoRld+eGHns9laPR0TEPCSCfWDR3LY7qz4Ubdm/43GV9xudvL0/VxBvn3eXVClseI2 XpKDZCI9XG5/rWPPjCHuDyj5qFLDBMwh1CtOh9qlVT8rBw9f6sUuSSOnH2DXhQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3drg-0002OF-Kp; Thu, 16 Nov 2023 10:01: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 1r3drf-0002Ny-39 for guix-devel@gnu.org; Thu, 16 Nov 2023 10:01:07 -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 1r3dre-0003kG-6h; Thu, 16 Nov 2023 10:01:06 -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=JRWsot3HC91PpTeN/F0asCTDHWgOHwzR2qWa4A1Bp3k=; b=EFFrVOn+sb0QD6GPX4JP 8f5OwaA2A7+mECrcsYkFbfO1Zuv+usxeYIksbqS8IQff3OujgiQOdQO2zwRd4hwH9IKfy2FdGSgic OPJ8PLdLfGlN7aDG3oHQ+ZGKeUL+f9nVSYHNHNwCj43R2HEV+OU1f+VVVCqPJr0ltm8ZHwGZjCuM1 1mRM4n2DYIhFPnuYvWa2kaZKfFBp9xAUr091lssrz1VsEksnjYjYQTq0FC6RkECRV3uS/K9L02A35 TRyzKO2XdreJtjulD6i7Bahs2NoOqXsLD17zwcSl43q74UMuU4m21r/nq4JLbuY2jhTxUoKIePPXl LNUsq1wzOg2TNA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Christopher Baines Cc: guix-devel@gnu.org Subject: Re: Performance of computing cross derivations In-Reply-To: <87zg00xvuv.fsf@cbaines.net> (Christopher Baines's message of "Mon, 30 Oct 2023 10:03:25 +0000") References: <87zg00xvuv.fsf@cbaines.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Sextidi 26 Brumaire an 232 de la =?utf-8?Q?R=C3=A9vo?= =?utf-8?Q?lution=2C?= jour de la Pistache X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 16 Nov 2023 16:01:04 +0100 Message-ID: <87y1exvj2n.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: A7ECE31A0B X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -10.82 X-Spam-Score: -10.82 X-TUID: tfr7hPZzqQAz Hi, Christopher Baines skribis: > When asked by the data service, it seems to take Guix around 3 minutes > to compute cross derivations for all packages (to a single > target). Here's a simple script that replicates this: To understand the cost of computing a package=E2=80=99s derivation, I gener= ally start looking at caches and memoization: --8<---------------cut here---------------start------------->8--- $ GUIX_PROFILING=3D"object-cache" guix build gcc-toolchain -d --no-grafts /gnu/store/iwn6frqqcyw808sgsnjv26dn6rq7mijd-gcc-toolchain-13.2.0.drv Object Cache: fresh caches: 19 lookups: 3667 hits: 3342 (91.1%) cache size: 323 entries $ GUIX_PROFILING=3D"object-cache" guix build sed -d --no-grafts --target=3D= aarch64-linux-gnu /gnu/store/yxakl87wizwzcqapx4sdkp56652cxb4m-sed-4.8.drv Object Cache: fresh caches: 20 lookups: 5420 hits: 4919 (90.8%) cache size: 500 entries --8<---------------cut here---------------end--------------->8--- Caches are critical: since we=E2=80=99re dealing with huge package graphs, = we need to make sure we don=E2=80=99t end up computing the same thing several times. (You can also add =E2=80=9Cmemoization=E2=80=9D to the =E2=80=98GUI= X_PROFILING=E2=80=99 variable above.) One idiom that defeats caching is: (define (make-me-a-package x y z) (package =E2=80=A6)) Such a procedure returns a fresh package every time it=E2=80=99s called, preventing caching from happening (because cache entries are compared with =E2=80=98eq?=E2=80=99). That typically leads to lower hit rates. Anyway, lots of words to say that I don=E2=80=99t see anything immediately obvious with cross-compilation, yet I wouldn=E2=80=99t be surprised if some= of these cache-defeating idioms were used because we=E2=80=99ve payed less attention to this. An even better thing to start with: compare the timing of =E2=80=98guix bui= ld -d --no-grafts $PKG --target=3Daarch64-linux-gnu=E2=80=99 for all valid values= of $PKG, and investigate those that take the most time. HTH! Ludo=E2=80=99.