unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: pinoaffe <pinoaffe@airmail.cc>
Cc: 50755@debbugs.gnu.org
Subject: [bug#50755] [PATCH v2] import: Generate list of importers based on available modules
Date: Mon, 27 Sep 2021 16:28:30 +0200	[thread overview]
Message-ID: <CAJ3okZ3FtEN8ytJqjv0HiCkpgMxp2KbofUB07i3aV-3c7c3SOA@mail.gmail.com> (raw)
In-Reply-To: <87wnn7ouq3.fsf@airmail.cc>

Hi,

Thanks.  Two comments.

On Thu, 23 Sept 2021 at 23:20, pinoaffe <pinoaffe@airmail.cc> 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




  reply	other threads:[~2021-09-27 14:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 12:24 [bug#50755] [PATCH] import: Generate list of importers based on available modules pinoaffe
2021-09-23 18:07 ` Sarah Morgensen
2021-09-23 21:17   ` pinoaffe
2021-09-23 21:19 ` [bug#50755] [PATCH v2] " pinoaffe
2021-09-27 14:28   ` zimoun [this message]
2021-09-27 18:27     ` pinoaffe
2021-09-27 18:20 ` [bug#50755] [PATCH v3] " pinoaffe
2021-09-27 20:09   ` zimoun
2021-09-28  9:51     ` Maxime Devos
2021-09-28 14:39       ` pinoaffe
2021-09-29 20:59         ` Maxime Devos
2021-09-30  8:17           ` pinoaffe
2021-09-30  8:37             ` Maxime Devos
2021-10-11 11:51               ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ3okZ3FtEN8ytJqjv0HiCkpgMxp2KbofUB07i3aV-3c7c3SOA@mail.gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=50755@debbugs.gnu.org \
    --cc=pinoaffe@airmail.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).