From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6NcuKjjVUWGkcAEAgWs5BA (envelope-from ) for ; Mon, 27 Sep 2021 16:29:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id mLnsJTjVUWH8KgAA1q6Kng (envelope-from ) for ; Mon, 27 Sep 2021 14:29:12 +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 2004E156DC for ; Mon, 27 Sep 2021 16:29:12 +0200 (CEST) Received: from localhost ([::1]:44252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUrd1-00016U-9H for larch@yhetil.org; Mon, 27 Sep 2021 10:29:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUrcs-00014v-Gz for guix-patches@gnu.org; Mon, 27 Sep 2021 10:29:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUrcs-0002E5-8A for guix-patches@gnu.org; Mon, 27 Sep 2021 10:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mUrcs-0007n6-4w for guix-patches@gnu.org; Mon, 27 Sep 2021 10:29:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50755] [PATCH v2] import: Generate list of importers based on available modules Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 27 Sep 2021 14:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50755 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: pinoaffe Cc: 50755@debbugs.gnu.org Received: via spool by 50755-submit@debbugs.gnu.org id=B50755.163275293429931 (code B ref 50755); Mon, 27 Sep 2021 14:29:02 +0000 Received: (at 50755) by debbugs.gnu.org; 27 Sep 2021 14:28:54 +0000 Received: from localhost ([127.0.0.1]:42310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUrck-0007mh-Be for submit@debbugs.gnu.org; Mon, 27 Sep 2021 10:28:54 -0400 Received: from mail-qk1-f178.google.com ([209.85.222.178]:41849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mUrce-0007mO-TM for 50755@debbugs.gnu.org; Mon, 27 Sep 2021 10:28:52 -0400 Received: by mail-qk1-f178.google.com with SMTP id m7so20092950qke.8 for <50755@debbugs.gnu.org>; Mon, 27 Sep 2021 07:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0R26zy0JvTG/ZwCflVNYiYXi5Pob1eJUj8CAxfCCfMk=; b=FBP+v4dOOHnoG0WeLsfTFWckX3TMDYnFNdXYMfhpbjfBOFVd9QeCH5hHeK/T7PP0bx qKF/HaTF9tkEMJ0C1NI/Qypibj+1rLbhiCn0dsqZjxAPtRXeNYQ2jis7y8FFwf/LirVz z3CKhwjvP2/GPEpVWm42qg1lORTxTvZ+AsIMJtOXPb4R29dzizWSAmuOMAHNNyszZRW7 9fEF+/wUiXaubEJl/Q/s7xdlW2jD2faaMPMkszfO506cxFv7QZq1LP0mKF1vVd6j3WcD X5oZyM48Skix8MCXSnu+kH7agDIAPmaeZ/caqpfETVmW/Wznes/M8j6PzfdXspVY5Nyu wQUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0R26zy0JvTG/ZwCflVNYiYXi5Pob1eJUj8CAxfCCfMk=; b=PBX6rL/rYSp8MQR47TY1DisIYfnIcLqLBBHOc2k3m1LdSJouQy1BDlxgpjxz8onHU9 eFlfnb7uGR6cW5ypQWy6p2zFZuQu+TkkJE5pW5TNz/qxLZxiDKKzYXst2Aa4BsZ0wTrH O6ysiDV0eGi+DKKtxhwgMA8/AzJq3w/SS/0bJQo1gTFJPIJv84QyVgGiSqThnxP9UCAz EAr+v0Flm/PqsrRtQ4kNPwczZ5cPBE274SbYG2eqZQYkWeCTwBnSK+Z7o63+XPhfdJlL eEfIRsFGNhs2qnxRb9mW1SJL47dSuWiL0Tg+L9vz5ix6PNnZBwEbaG0fBCeoKTJ485Jw 2Mqw== X-Gm-Message-State: AOAM530QCTr+HapiLyXrNCcP35HUdL5v14Z5ZpIn0cOND3+W1l4XNg9F 1OuS6gEa54/XGpC4+2WhgZ0RwDjsOdOCC+K849VquL6JmRQ= X-Google-Smtp-Source: ABdhPJxtKMdlHQsWDmAcmHYuNWThm4NPDK7oUQ7GYt39i0oK86gjP9LAW29V8AGYH/wj3YLTkoHNtPsZzKEVt3AzHdo= X-Received: by 2002:a37:993:: with SMTP id 141mr222374qkj.488.1632752923255; Mon, 27 Sep 2021 07:28:43 -0700 (PDT) MIME-Version: 1.0 References: <87tuibh43w.fsf@airmail.cc> <87wnn7ouq3.fsf@airmail.cc> In-Reply-To: <87wnn7ouq3.fsf@airmail.cc> From: zimoun Date: Mon, 27 Sep 2021 16:28:30 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" 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=1632752952; 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=0R26zy0JvTG/ZwCflVNYiYXi5Pob1eJUj8CAxfCCfMk=; b=OfZ/iPDUkQKojk+JYJqwriW+cdenT5KF/CVz1f/CHJbYlUgag/MOpyTfKAR8SnrScF4Azf EiKQIxKr7+BiuicUw2QhqQzV1ys0hbLtRlbxWoGYiVZccICbr/odSsi3hbC3iZZis/D4fd S8PbX7/+SoOBgvObtAqFwEcz8/xoc/3FJiOmZ+gCVMLB4b4ZrAveu0esRMQHyhCuYBtCTe 7OeG8x6gj4AAmU95BbP+j8qGr8Rpcds9MqKbtE/zEB/cfhkLfYo0wWq3NPFWOoHCCOjTak zY7pvDKBIYBJt1r3PlQMmSOHMLRXZcHX2S273sUClzBhMdyh9QmTKbFY91pxcw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632752952; a=rsa-sha256; cv=none; b=O5ZWAv1CAIzoMG0MikGKFLyqhCiVA6TmV0OL+JVzAdSSWH2kK0chtX9pdxWKz5OxqK9J5O 8C8I/48k4eMJcMb4e42JQzMXpQ9eds1y5EfzGn/iH3L+ZxQoAPxu+bq+0QEMsW6TToOyY6 N1uzjpz4I/CRLVkOpvza0tGh/mMjsc7Z3XJXImZk0JrnlLzimwYGxSdz6a4EsgLWuob8zS MkZ6b9EjbNX25gOUJ2PdBlKtKJlUnkboIK8iTJs848cxraqaO299b5tGggeoDs0v75l4wO 03/zrZ6DaxlmZ7NVsomUdiqQzwrp/5uWQgfUlpVH6azKwFs29vAncRIFg63ijg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=FBP+v4dO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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.29 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=FBP+v4dO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Queue-Id: 2004E156DC X-Spam-Score: -1.29 X-Migadu-Scanner: scn0.migadu.com X-TUID: ArrNHIwpMZ7r Hi, Thanks. Two comments. On Thu, 23 Sept 2021 at 23:20, pinoaffe wrote: > -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" > - "gem" "go" "cran" "crate" "texlive" "json" "opam" > - "minetest")) > +(define importers (filter-map (lambda (module) > + (match (module-name module) > + (`(guix scripts import ,importer) > + (symbol->string importer)) > + ( #t #f))) > + (all-modules (map (lambda (entry) > + `(,entry . "guix/scripts/import")) > + %load-path)))) > > (define (resolve-importer name) > (let ((module (resolve-interface First, I think, it breaks "guix import --help". Therefore, this patch needs a v3. :-) Second, what is the average extra time added on cold cache? On my machine, for hot cache, I get: --8<---------------cut here---------------start------------->8--- $ time guix import cran -h real 0m0.113s user 0m0.110s sys 0m0.025s $ time ./pre-inst-env guix import cran -h real 0m0.470s user 0m0.529s sys 0m0.054s --8<---------------cut here---------------end--------------->8--- which is something. On cold cache, it is: real 0m10.438s user 0m0.164s sys 0m0.082s vs real 0m12.226s user 0m0.897s sys 0m0.190s but these numbers are not so much meaningful because there is a strong variability; hence on average. :-) Because of 'filter-map', it walks all the modules, so there is a performance loss. The question is: which performance loss is acceptable here? Other said, is the code improvement worth compared to the performance decrease? All the best, simon