From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QIT9FZPvUWH3KgAAgWs5BA (envelope-from ) for ; Mon, 27 Sep 2021 18:21:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uP6qEZPvUWHWSgAAbx9fmQ (envelope-from ) for ; Mon, 27 Sep 2021 16:21:39 +0000 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 AD10C17E2B for ; Mon, 27 Sep 2021 18:21:38 +0200 (CEST) Received: from localhost ([::1]:36234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUtNp-0004Lq-Lc for larch@yhetil.org; Mon, 27 Sep 2021 12:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUtKN-00009W-6E for guix-patches@gnu.org; Mon, 27 Sep 2021 12:18:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59327) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUtKM-0007z4-VZ for guix-patches@gnu.org; Mon, 27 Sep 2021 12:18:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mUtKM-0005CC-Qt for guix-patches@gnu.org; Mon, 27 Sep 2021 12:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50384] [PATCH v4] Optimise search-patch (reducing I/O) Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 27 Sep 2021 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50384 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Maxime Devos Cc: 50384@debbugs.gnu.org Received: via spool by 50384-submit@debbugs.gnu.org id=B50384.163275946819933 (code B ref 50384); Mon, 27 Sep 2021 16:18:02 +0000 Received: (at 50384) by debbugs.gnu.org; 27 Sep 2021 16:17:48 +0000 Received: from localhost ([127.0.0.1]:42637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUtK8-0005BR-5V for submit@debbugs.gnu.org; Mon, 27 Sep 2021 12:17:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUtK6-0005B9-HX for 50384@debbugs.gnu.org; Mon, 27 Sep 2021 12:17:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33442) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUtJz-0007en-3r; Mon, 27 Sep 2021 12:17:39 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36396 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUtJy-0003WL-Nu; Mon, 27 Sep 2021 12:17:38 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <8900fa8c8eef7f72fc97adc2408be26c88de7803.camel@telenet.be> <87tuj0xaja.fsf@gnu.org> <0ec7f0270fcccec730808f9210f074cd5339961f.camel@telenet.be> <87ee9xerac.fsf_-_@gnu.org> <87r1dhj2bk.fsf_-_@gnu.org> <3563a99b37c8ef3b226b7fef25a5afa273c08b6e.camel@telenet.be> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 6 =?UTF-8?Q?Vend=C3=A9miaire?= an 230 de la =?UTF-8?Q?R=C3=A9volution?= 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: Mon, 27 Sep 2021 18:17:36 +0200 In-Reply-To: <3563a99b37c8ef3b226b7fef25a5afa273c08b6e.camel@telenet.be> (Maxime Devos's message of "Thu, 23 Sep 2021 19:26:51 +0200") Message-ID: <87czouj8m7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632759698; 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: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; bh=1kZgN01eqbQPHm6eiglhz7X31iQXTwbuGyPnT7/lsec=; b=PGwP05hjkSgYwqTTHuyUV92xAGCeA5QA8TJABJKZelx9Bj/xUeQsuJEUmC/3NXrXnQlsii wMQkh/uSO7MMUQ/EqDRMhvB9qBYoHoe6uI0uEdtreLZANfvLNR1jHsjL7472p/x7otP6Ve dhR/gE+bC/Z5pEeqNb/w6q9liR0noS45ptkSbLbLoqf3ofJ9kkC5jzkZ8g2N1zsU/RKlhc DKn9CMqL+h6JNEDjEEyDccM9MCGWoXkfXR0Y7C0FgwBGdC5po0ITQ2iVnSEPjGtOsCPwrG UpnI4msK1Ld/Px9GJneR9XYe3Taepy6hLQA+5wmDwPh10B4V0XrxeVRZxVcHAA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632759698; a=rsa-sha256; cv=none; b=ssd42e70ft5hFqAZmZLTyKq9Tame78zafKWYs8YJVPKJhxGRfTkKspW5aV2316RqOueB/P POy4ZcjPSKlDoTXxh1tdIjMH11uxSnsYuI8lEC/3k73xY9RTilFKQtIRm5juinDIsxtWp2 4F0bl5yUgvFQX6CcrnlWrBXnKwc7ibbFezqmrYbQPXpR+4zpk+NWv2xrhD+BDzMIyMvj5V kzWkyda9MZk71dZ2V/b46RtYUFT4qbH6iuAB/ZjMADoM3BP0AIJY/8GEkKHSUZ4FJgjQER vNL0s57przJGSamiTcNT4tquPn7TH1TC6b2QJVl3+LzaYEjaZAz8U0aHsywpKw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.39 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: AD10C17E2B X-Spam-Score: -1.39 X-Migadu-Scanner: scn0.migadu.com X-TUID: Y3ud6k8DnFj8 Hi, Maxime Devos skribis: > Ludovic Court=C3=A8s schreef op di 21-09-2021 om 18:55 [+0200]: [...] >> Looking at the big picture, what I=E2=80=99d like to have is a package >> derivation cache designed in such a way that =E2=80=9Cguix install foo= =E2=80=9D wouldn=E2=80=99t >> even need to load any package module on a cache hit. That=E2=80=99d mak= e a >> noticeable difference performance-wise, that=E2=80=99s another level of >> complexity=E2=80=A6 (I have a rough design in mind that we could discus= s.) > > This =E2=80=98package derivation cache=E2=80=99 seems an interesting idea= to pursue, > though I wonder what could be used as =E2=80=98keys=E2=80=99 in the deriv= ation cache. The existing package (used by =E2=80=98find-packages-by-name=E2=80=99 & co.= ) already has keys: the module and variable name of a top-level package definition. More precisely, there=E2=80=99d be two keys: (1) a hash of the channel inst= ance commits being used (as you wrote), and (2) the module/variable name. That means we=E2=80=99d only keep packages with a public top-level definiti= on in the cache. Rough design sketch: The idea I have in mind would be to have be a sub-record-type of , where would contain only the metadata currently provided by =E2=80=98fold-available-packages=E2=80=99 (m= ainly: name, version, module/variable). would have a gexp compiler that looks up the package/derivation mapping in ~/.cache/guix and either return it directly (cache hit) or look up the corresponding , do all the work, and add an entry in the cache (cache miss). Challenges include: arranging so (guix records) can deal with record type inheritance, deciding what to do with grafts, and probably more. >> Ludovic Court=C3=A8s skribis: >>=20 >> > > +;; repeated 'stat' calls. Allow computing the hash of the file in = advance, >> > > +;; to avoid having to send the file to the daemon when it is alread= y interned >> > > +;; in the store. >> > > (define-record-type >> > > - (%%local-file file absolute name recursive? select?) >> > > + (%%local-file file absolute name sha256 recursive? select?) >> > > local-file? >> > > (file local-file-file) ;string >> > > (absolute %local-file-absolute-file-name) ;promise string >> > > (name local-file-name) ;string >> > > + (sha256 local-file-sha256) ;sha256 bytevecto= r | #f >> >=20 >> > Could we store the result of =E2=80=98fixed-output-path=E2=80=99 rathe= r than the SHA256, >> > while we=E2=80=99re at it? > > Embedding the result of =E2=80=98fixed-output-path=E2=80=99 in the .go mi= ght be problematic > from a closure size perspective, as that would create additional referenc= es in the > store items of guix. Yes, I wonder, not sure about that. > As it is only <1%, I would prefer trying the =E2=80=98package derivation = cache=E2=80=99 > first, as it seems to have more potential. Alright. Thanks, Ludo=E2=80=99.