From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id iF8nKFmSnmXYZAEAkFu2QA (envelope-from ) for ; Wed, 10 Jan 2024 13:49:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id kEtKJVmSnmUR8QAAqHPOHw (envelope-from ) for ; Wed, 10 Jan 2024 13:49:29 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; 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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704890969; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Ef6J1sXlfTRuYudMaH1cxcjm3xRczx4HaiX8Ea8d184=; b=GkZZmJH44nlDEcQXQWsTC/QsZiSlHG+n00RtxY3N7h4YhtFC9gihoiiy+1l+OVWp3UJ1Zv STWVuvSEHnvR20d67ymnjb677m8FKIqI6FscMhHhQuquFQH/mLRJ6m+MXMn1keEcLvY5LX y8wHe8ehgEFnMYwrMKgTck2mS850jQe4lwDNTpKfV5blgbJjx5UuAQbMLP9Yurw3HKEiCs tVD81vo3m+VHqXSJ20rgE8ut6LBh4X8ATC7448jP25zwfUCODbs5LeCE8nP96auUEyBUHq fTpXyV/yrvRHc7m4lEtYTLLzSi2I46YRl9jfhAryHE+PnA44pS23Om+Rx/YcNw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704890969; a=rsa-sha256; cv=none; b=BrUGWVsifBIKsXVsDpJ8MAf9or567UXhfy94pUk7Gea82UgrjCp1UVHV/UdnGb7x817F/7 Fu/4rcOyyGAZVkDqlvH7/jghdVPG0HlQMUtdbTuUjj52af08y+vnInSxIcs951RgAhZFka qY+adNPa99FJwA5BxOWbXinz2CIWh6S7AT7b6QRUQuE1sJhZAJWWxJStYLsyTNUFoKpYwA iEBZxdmRg3x9u5KWgKrL8ESybo0OUiee2pmb2p8vE3S4lobtxyAOWJOnTm7b80zkG0DJWf t/1MbxXVDf5dW86iuyiTPCOC/XROfg1BTIv8j8lru6tb/ZuBmGkeZkJc8eI6Bw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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"; dmarc=none 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 7AC3562727 for ; Wed, 10 Jan 2024 13:49:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNY0g-0005Xp-OW; Wed, 10 Jan 2024 07:48:42 -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 1rNY0e-0005XC-5j for guix-devel@gnu.org; Wed, 10 Jan 2024 07:48:40 -0500 Received: from mira.cbaines.net ([212.71.252.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNY0a-0000uT-Lw; Wed, 10 Jan 2024 07:48:39 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 0FDAE27BBE9; Wed, 10 Jan 2024 12:48:33 +0000 (GMT) Received: from felis (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 66fd2427; Wed, 10 Jan 2024 12:48:32 +0000 (UTC) References: <87zg00xvuv.fsf@cbaines.net> <87y1exvj2n.fsf@gnu.org> <87le93r9v3.fsf@cbaines.net> User-agent: mu4e 1.10.7; emacs 29.1 From: Christopher Baines To: Efraim Flashner Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guix-devel@gnu.org Subject: Re: Performance of computing cross derivations Date: Wed, 10 Jan 2024 12:40:07 +0000 In-reply-to: Message-ID: <878r4xgxr6.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-Spam-Score: -8.41 X-Spam-Score: -8.41 X-Migadu-Queue-Id: 7AC3562727 X-Migadu-Scanner: mx12.migadu.com X-TUID: G4cIzSed16Ju --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Efraim Flashner writes: > [[PGP Signed Part:Signature made by expired key 41AAE7DCCA3D8351 Efraim F= lashner ]] > On Fri, Jan 05, 2024 at 04:41:14PM +0000, Christopher Baines wrote: >>=20 >> Ludovic Court=C3=A8s writes: >>=20 >> > 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: >>=20 >> ... >>=20 >> > 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 calle= d, >> > 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 immedia= tely >> > 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. >>=20 >> I've got a feeling that performance has got worse since I looked at this >> originally, I've finally got around to having a further look. >>=20 >> I spent some time looking at various metrics, but it was most useful to >> just write the cache keys of various types to files and have a read. >>=20 >> The cross-base module was causing many issues, as all but one of the >> procedures there produced new package records each time. There is also >> make-rust-sysroot which showed up. >>=20 >> I've sent some patches as #68266 to add memoization to avoid this, and >> that seems to speed things up. >>=20 >> Looking at other things in the cache, I think there are some issues with >> file-append and local-file. The use of file-append in svn-fetch and >> local-file in the lower procedure in the python build system both bloat >> the cache for example, although I'm less sure about how to address these >> cases. >>=20 >> One thing I am sure about though, is that these problems will come >> back. Maybe we could add some reporting in to Guix to look through the >> cache at the keys, lower them all and check for equivalence. That way it >> should be possible to automate saying that having [1] in the cache >> several thousand times is unhelpful. The data service could then run >> this reporting and store it. >>=20 >> 1: # "/bin/svn"> > > I grabbed the patch for make-rust-sysroot to try it out: > Native builds: > time GUIX_PROFILING=3D"object-cache" ./pre-inst-env guix build --no-graft= s $(./pre-inst-env ~/list-all-cargo-build-system-packages | grep rust- | he= ad -n 100) -d ... > That's a massive drop in the size of the cache and a big decrease in the > amount of time it took to calculate those 100 items. I think you're right, while I send some other changes in #68266, I think it's this change around make-rust-sysroot that has pretty much all the effects on performance. I think the tens of thousands of duplicated packages from cross-base that I was looking at are almost entirely coming from make-rust-sysroot. As Ludo mentions in [1], maybe this has something to do with use of cross- procedures in native-inputs, although I'm not sure that moving those calls out of native-inputs is a correct thing to do. I don't know what the correct approach here is, but I think something needs doing here to address the performance regression. 1: https://lists.gnu.org/archive/html/guix-patches/2024-01/msg00733.html --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmWekh1fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XdoNxAAhkVKaUuk/adLBjEwPVwQf6YEJOTUcBah IZEHEH0VbQ7eGUErHuZXlW0eqsp1mH1N8rPIYzFwUB+LFmtxqEI6k+oj2UkdPw3e SQy/p3m9TmbSCKZwjTISDTvhU9eoEkcbQWjmxgiEkacS5EymBL3zJl29jj7EDE5y blNRlQRwg44eWO1fVUP9+pSTjbinPZbAS6caJmMI9IMNaC5gZ7H38vA/dfY+5dNT qkAHevxuqqqIfYnq/s85ekMfDBmBEhMzeMAx0MyL/Bd+8GbQq/Y6zAtTzoGr+ZrM 3IVPB0uU2RbizOP0cUCtFLX2gQZvtyhdFXTfM2Q94mf4WfXt/itisPhjsY3tc6+a af2qaxdBDC/3I1+xb5qngJfzWjvF6BsrB97Rg2M6KC9zymTYiNxRI69ZaoHg9vFh Go5NilgCqBiUo8AOXmDXarZn0JiwipNy5QIfpJX0rCZ0shuC2Vp3657J/cTAy9tK oiptrHkT5ABwUWca0LFtu0Jdig5IEB9LtNMKkLKlzpxN2W5S/zy/4tmVgvNm+jcV b00R/ea46V8jeoSMaoR42Ry3PoTAybPitj70YXZH3n8mjzacrPIDDY2VcLlIKHSf cZ11Y8WOOIYTstlYvUzxS6Mx1TQTBzPN/Fnq4wPCdPfaBAxON5TAcFX4S3brYKCZ RaxBdmv/XRg= =sRBI -----END PGP SIGNATURE----- --=-=-=--