From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id VoX5CEXBM2GY5gAAgWs5BA (envelope-from ) for ; Sat, 04 Sep 2021 20:56:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QHssBEXBM2GDBgAA1q6Kng (envelope-from ) for ; Sat, 04 Sep 2021 18:56:05 +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 0778C16F9F for ; Sat, 4 Sep 2021 20:56:04 +0200 (CEST) Received: from localhost ([::1]:45648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMapf-0002yZ-1J for larch@yhetil.org; Sat, 04 Sep 2021 14:56:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMani-0001WI-Bp for bug-guix@gnu.org; Sat, 04 Sep 2021 14:54:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMani-0002Lj-3J for bug-guix@gnu.org; Sat, 04 Sep 2021 14:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mMani-0004fA-2F for bug-guix@gnu.org; Sat, 04 Sep 2021 14:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50349: [PATCH] packages: Add 'define-package' syntax. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 04 Sep 2021 18:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50349 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: Taylan Kammer Received: via spool by 50349-submit@debbugs.gnu.org id=B50349.163078159017847 (code B ref 50349); Sat, 04 Sep 2021 18:54:02 +0000 Received: (at 50349) by debbugs.gnu.org; 4 Sep 2021 18:53:10 +0000 Received: from localhost ([127.0.0.1]:48582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMams-0004dm-9a for submit@debbugs.gnu.org; Sat, 04 Sep 2021 14:53:10 -0400 Received: from out1.migadu.com ([91.121.223.63]:53231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMamp-0004dd-E5 for 50349@debbugs.gnu.org; Sat, 04 Sep 2021 14:53:09 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1630781585; h=from:from: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; bh=k33hJIsXchHXxh7V16A+NbMCP2cFOVvuMlEVBnfk5TE=; b=T58MxaOS4VKKqC4R11fGh/iV2Q2+MzV0NF6mfdmZ29NatRGJAziqkxvVaITh/RIpAy7cvo bxaIdg3skyc4iqxibjrlWaUfEOd+Au3d41zITYPWFe+rSn4PTxrrjjpIDqWgUO/E68ibki paBADPny7KD7IQyd6NODfg6EbjcrHO0= From: Sarah Morgensen References: <15d01b32313f5f2f291b120597719ae92bd26acd.1630639896.git.iskarian@mgsn.dev> <757b7543b931335c3725264edfbc79c012aa10fc.camel@telenet.be> <87y28caazy.fsf@nckx> <95c92fc5-1fcf-b347-370e-d1943f22c2c3@gmail.com> <87bl58wfk7.fsf@nckx> Date: Sat, 04 Sep 2021 11:53:03 -0700 In-Reply-To: (Taylan Kammer's message of "Sat, 4 Sep 2021 19:23:29 +0200 (1 hour, 11 minutes ago)") Message-ID: <86v93gjhps.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Auth-User: iskarian@mgsn.dev 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 50349@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630781764; 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:dkim-signature; bh=k33hJIsXchHXxh7V16A+NbMCP2cFOVvuMlEVBnfk5TE=; b=ix3f9Yst/J8hLlkfO42oldeViAiq/Yjxp2nCUipHkV65p5VCpjrtWg/cF8U9ogRaor32sq c/udb86u6HSZSBjwmMeganOfVrf/AxcyFnSQD8NeMFRGPVpHGUnmwTGTD9pxJsQng8RSWb pvewL7CQ5Iz10P8OAAe2H/ck3PPZGJMTyoqK8Z9HslQwrRN9PAD6yjJbBbe/sio3erym80 3enxOHP3NwT0UWn7fxcdxtqCR3aziHD/n0wr3c+HlLoSqHi3LHIeJijcvkQAIU6SlTS/dB KiJr44JG/+n+j0U/cINZ4+BCT0oykDBlDmYmuNWRsZ2Y2JixZp63IxW5ctInnA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630781764; a=rsa-sha256; cv=none; b=M2hOSq8V9p2CSQe4TJtNCcleXFvD1QvyJfsPxTpChBjMMfUJj4rnKmzA4UG34Jx2Q9JKbh vidFzlAJn6AZt5LXIYeFS2SMVHU1xxAka7t4j1iyRjXNvH+Ynb71ci8VHS+6GDC3Om3L6m itbeVqGeWkbako7MtVg8S/huHthtcFU92pxHlOrEVko6AsG1P6LmPWteNvPyS3djSlLSC4 4GfSXvTUpYetmmsCHu9ITgXhkwDqonwMT7zd+B7UzWzHSbkNI8iAZ/MSJX5tSAgpOR5zQU 76dzFuN+9AGU6AOYUjV95cAD/Hg+w7rSDi7wHUsW27GorDzS2F16WoXTfBF2fg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=T58MxaOS; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: 0.18 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=T58MxaOS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 0778C16F9F X-Spam-Score: 0.18 X-Migadu-Scanner: scn1.migadu.com X-TUID: lXNJNdeVpfL+ Hi Taylan, Taylan Kammer writes: > On 04.09.2021 16:44, Tobias Geerinckx-Rice wrote: >> Taylan Kammer =E5=86=99=E9=81=93=EF=BC=9A >>> To me the most obvious thing to do seems >>> >>> =C2=A0 (define-package foo ...)=C2=A0 ;no explicit name needed >>> >>> to bind the variable 'foo' and use symbol->string for the name of the >>> package, with the possibility to override the name like >>> >>> =C2=A0 (define-package foo (name "foobar") ...) >>> >>> which would bind the variable 'foo' to a package named "foobar". >>=20 >> Right, that's what I meant, and it's how I read bug #15284, and it looks= remarkably like the form I use in my personal channels (and I'm sure I'm n= ot the first! :-). >>=20 >> You're much better at the language/implementation side of things than I = am, Taylan.=C2=A0 Would this negatively affect performance (including =E2= =80=98guix pull=E2=80=99 compilation)? >>=20 >> Kind regards, >>=20 >> T G-R I agree; if we added that magic, that's definitely how it should be. > > I'm flattered, but don't really know the answer, so I decided to attempt > some sort of benchmark. :-P > > test1.scm uses the syntax-case macro, test2.scm just define-public. > > I don't actually import the Guix modules, so the (package ...) form isn't > macro-expanded, regardless of whether it's used directly or results from > expanding define-package. > > This way, the impact of define-package should dominate the time differenc= e. > > The results are... interesting. I started out with 256 definitions in the > files, and the define-package one would take about 4.2s to compile while > the regular one about 3.9s. There was some jitter in the results though > after running it several times so I thought, let's increase the number of > packages to reduce noise. > > With 512 packages, the one using regular define-public takes a whole > minute to compile, whereas the define-package one just ~14 seconds! > > So no idea what's going on there, and how the use of this macro in the > actual (gnu packages ...) modules would affect performance. :-) Thanks for running some benchmarks. Were both those latter runs with a warm cache? If so, is it possible that due to a compilation optimization, many of the global symbol lookups only happen once with the define-package macro? If you were really interested, I suppose you could test with compilation optimization off, but I'd be more interested in the performance impact with (guix packages) imported. -- Sarah