GNU bug report logs - #50755
[PATCH] import: Generate list of importers based on available modules

Previous Next

Package: guix-patches;

Reported by: pinoaffe <pinoaffe <at> airmail.cc>

Date: Thu, 23 Sep 2021 12:25:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: zimoun <zimon.toutoune <at> gmail.com>
To: pinoaffe <pinoaffe <at> airmail.cc>
Cc: 50755 <at> 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
Hi,

Thanks.  Two comments.

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




This bug report was last modified 3 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.