From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <bug-guix-bounces+larch=yhetil.org@gnu.org> Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 0PIoGSvPameWhgEA62LTzQ:P1 (envelope-from <bug-guix-bounces+larch=yhetil.org@gnu.org>) for <larch@yhetil.org>; Tue, 24 Dec 2024 15:11:39 +0000 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 0PIoGSvPameWhgEA62LTzQ (envelope-from <bug-guix-bounces+larch=yhetil.org@gnu.org>) for <larch@yhetil.org>; Tue, 24 Dec 2024 16:11:39 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Seo1Rnsi; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=kTbnAqyK; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-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=1735053099; 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=FngbVgWVrsYRyIDLwxin5BdpV8DOfQCd09vVy/G6x0Q=; b=b3+AKZK2ioBAp3E4+EwNHQuZvGqrST9Tu0Thu8diulYEPBeCeSYzih6QEkRrh8K14xtvB+ +9SZ3qCt7Dar/FCE9qkpBurNWbfLlwzCbolqx14Rav1g9y/kNTyVHplYywVYxiPS5978o/ 7u0RmNDPz6YqZXfMBTdDUjOfi+nRUs/djt/IgIzCyo+5oUgGwfU/+zmuGOgtRQfq0dEHAN bfuzFUfYFI9BnHuGEoyhaUXL+WWzEyRFxoDvHXlKWs7KrxNZHYaAs8UDxqw8U55MQk/fQ/ LqI9rxS6r+8zDfZwZLAsyMcRDgqrXnAEKFCB0IRJrm8qK2Zr0Vclj5B83KNIyw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Seo1Rnsi; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=kTbnAqyK; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735053099; a=rsa-sha256; cv=none; b=FbSCdg5mmCiTm6vAcSs04OQ24zsTCIahPhfQz6t0TaSR36DrHZV5ZllBHJf3fQN3YN82/G 4epmXobSUsi9Wn6ur82mEDV5OfFUn2DEFjJrFQf3UQpdVYtfMM6U/NCy+VwzmfYuinjYtS Fz6TMu34O9RDeYhpg2ip9NFWSNAi4DCpkXGT9I3gRc8m8XrJSoELYER4t3S7RdtjutztCq pbSWXk3saEd7MajlibC+ayLa7jLUb+q8qyRMfskWjpg97Yt0UVguHQAdvgYF7MXU/YKzSe QgD44eTeQq1R9NAJlN4q4KoDQYR1md+87nwVSISumTPP6TlXKFAe/JIlkc3VYQ== 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 9AF8997560 for <larch@yhetil.org>; Tue, 24 Dec 2024 16:11:38 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <bug-guix-bounces@gnu.org>) id 1tQ63u-0005eE-9M; Tue, 24 Dec 2024 09:39:06 -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 <Debian-debbugs@debbugs.gnu.org>) id 1tQ63r-0005dh-Ij for bug-guix@gnu.org; Tue, 24 Dec 2024 09:39:04 -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 <Debian-debbugs@debbugs.gnu.org>) id 1tQ63r-0007sk-As for bug-guix@gnu.org; Tue, 24 Dec 2024 09:39:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=FngbVgWVrsYRyIDLwxin5BdpV8DOfQCd09vVy/G6x0Q=; b=Seo1Rnsik5gooZSIQJctyqe1RxpzzV8atC/w8eOFdE25TbkbRJn/yx5r5ZMlTZjg1qyMSXCIY/TeaCp47EFWeper6A+VHnEbjU0bprTm9xpCqIBOo6d78tw8T9Z9WUIAJg2fYjE08pf+ZsSFNieFjh5jSPmz2YA5E9InhxeVADXe/g9kfGzzgn35VP8/0812KhtzevhB1SGXy28//1N26gyJG0g+85irKIciX5VwnXrYYaw1RjUbWlzpZaptKn5YCij3aYVL7PeGESvceYcwktv2WugWpTSN4A1Z+ySATCSFGq/I7fzmfZMAsW0sEGeP+6vARYe79MillumQ8McCRg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1tQ63q-0004Gs-4I for bug-guix@gnu.org; Tue, 24 Dec 2024 09:39:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#74748: Constructor created by define-configuration is slow (>25s) when many fields are defined Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 24 Dec 2024 14:39:02 +0000 Resent-Message-ID: <handler.74748.B74748.173505112316372@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74748 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Tomas Volf <~@wolfsden.cz> Cc: 74748@debbugs.gnu.org Received: via spool by 74748-submit@debbugs.gnu.org id=B74748.173505112316372 (code B ref 74748); Tue, 24 Dec 2024 14:39:02 +0000 Received: (at 74748) by debbugs.gnu.org; 24 Dec 2024 14:38:43 +0000 Received: from localhost ([127.0.0.1]:60068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1tQ63W-0004G0-JP for submit@debbugs.gnu.org; Tue, 24 Dec 2024 09:38:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@gnu.org>) id 1tQ63T-0004Fi-Nk for 74748@debbugs.gnu.org; Tue, 24 Dec 2024 09:38:41 -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 <ludo@gnu.org>) id 1tQ63N-0007qn-LY; Tue, 24 Dec 2024 09:38:33 -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=FngbVgWVrsYRyIDLwxin5BdpV8DOfQCd09vVy/G6x0Q=; b=kTbnAqyKGEkulqtA4FJy clcBI3JTXEajfk0kC55AuCT43OPj1+0eyQYzuSTAMXqOf1MqSgmUxeeGWx8NIQ73DVmb2O6gMOhmP wabpIPOzaYCU5Ve8AQezb4DXKUP9hA21BJ1ekoL63pMtj8RrhFzQW02ZLmn15KM7I9SRo1LfCbPeU auFfEgIygzJrtgV2HLOpAEQevAHaQOJx7y39eKZ1XNiG4Eoa8dEBgjxwpmMbaJ9uh+KAeqk6aQ1G9 YlarPkU5ZFVv5fYLaq23DKv7v0h0KZAnspelWUSTAhbkjN52IiztO3ia+HYvwudbPvLytDv6ZPama TkWge4caQ/a+ag==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org> In-Reply-To: <87msh499f7.fsf@wolfsden.cz> (Tomas Volf's message of "Mon, 09 Dec 2024 16:13:16 +0100") References: <87msh499f7.fsf@wolfsden.cz> Date: Tue, 24 Dec 2024 15:38:30 +0100 Message-ID: <87cyhh5eop.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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix <bug-guix.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-guix>, <mailto:bug-guix-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/bug-guix> List-Post: <mailto:bug-guix@gnu.org> List-Help: <mailto:bug-guix-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-guix>, <mailto:bug-guix-request@gnu.org?subject=subscribe> Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -7.41 X-Spam-Score: -7.41 X-Migadu-Queue-Id: 9AF8997560 X-Migadu-Scanner: mx10.migadu.com X-TUID: dowXqe7tSgzj --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Tomas Volf <~@wolfsden.cz> skribis: > I am writing a configuration for mpv and hit an issue of the generated > constructor (`home-mpv-configuration') is extremely slow. While the > almost 800 fields is unusually high, initializing the instances of the > record should *not* take almost 30 seconds. The full file is attached > to this email (as `mpv.scm'). AFAICS, time is spent in one of the compilation steps: --8<---------------cut here---------------start------------->8--- scheme@(gnu home services mpv)> ,o interp #t scheme@(gnu home services mpv)> ,t (lambda () (mpv-profile-configuration)) $13 =3D #<procedure 7f6ed3796700 at ice-9/eval.scm:330:13 ()> ;; 0.376347s real time, 0.375402s run time. 0.000000s spent in GC. scheme@(gnu home services mpv)> ,o interp #f scheme@(gnu home services mpv)> ,t (lambda () (mpv-profile-configuration)) $14 =3D #<procedure 7f6ec32088f8 at <unknown port>:40:3 ()> ;; 11.149828s real time, 12.052915s run time. 1.581736s spent in GC. scheme@(gnu home services mpv)> ,t (->bool (macroexpand '(mpv-profile-confi= guration))) $15 =3D #t ;; 0.373865s real time, 0.372698s run time. 0.000000s spent in GC. --8<---------------cut here---------------end--------------->8--- If we look more closely, it=E2=80=99s the optimizing compiler that takes ti= me; the baseline compile (-O1) is doing okay: --8<---------------cut here---------------start------------->8--- scheme@(gnu home services mpv)> ,use(system base compile) scheme@(gnu home services mpv)> ,t (->bool (compile '(mpv-profile-configura= tion) #:to 'tree-il #:env (current-module))) $20 =3D #t ;; 0.378741s real time, 0.377043s run time. 0.000000s spent in GC. scheme@(gnu home services mpv)> ,t (->bool (compile '(mpv-profile-configura= tion) #:to 'bytecode #:env (current-module))) $21 =3D #t ;; 11.946879s real time, 12.961704s run time. 1.777478s spent in GC. scheme@(gnu home services mpv)> (define til (compile '(mpv-profile-configur= ation) #:to 'tree-il #:env (current-module))) scheme@(gnu home services mpv)> ,t (->bool (compile til #:from 'tree-il #:t= o 'bytecode)) $22 =3D #t ;; 11.403420s real time, 12.317183s run time. 1.581972s spent in GC. scheme@(gnu home services mpv)> ,t (->bool (compile til #:from 'tree-il #:t= o 'bytecode #:optimization-level 1)) $23 =3D #t ;; 0.225455s real time, 0.156137s run time. 0.000000s spent in GC. --8<---------------cut here---------------end--------------->8--- Currently (guix build compile) applies these options to services: ((string-contains file "gnu/services/") ;; '-O2 -Ono-letrectify' compiles about ~20% faster than '-O2' for ;; large files like gnu/services/mail.scm. (override-option #:letrectify? #f (optimizations-for-level 2))) I think we should at least apply this patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/build/compile.scm b/guix/build/compile.scm index 5b27b55d02..f90016b9ae 100644 --- a/guix/build/compile.scm +++ b/guix/build/compile.scm @@ -127,7 +127,8 @@ (define (optimization-options file) ;; Use '-O1' to have partial evaluation and primitive inlining so we ;; can honor the "macro writer's bill of rights". (optimizations-for-level 1)) - ((string-contains file "gnu/services/") + ((or (string-contains file "gnu/services/") + (string-contains file "gnu/home/services/")) ;; '-O2 -Ono-letrectify' compiles about ~20% faster than '-O2' for ;; large files like gnu/services/mail.scm. (override-option #:letrectify? #f --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Would that be enough for the home-mpv configuration records you wrote? Thanks, Ludo=E2=80=99. --=-=-=--