Subject: Re: [bug#50755] [PATCH v3] import: Generate list of importers based on available modules

From: Maxime Devos <[email-masked]>
Date: Tue, 28 Sep 2021 11:51:48 +0200

zimoun schreef op ma 27-09-2021 om 22:09 [+0200]:
> Hi,
> 
> On Mon, 27 Sept 2021 at 20:21, pinoaffe <[email-masked]> wrote:
> 
> > +(define importers (delete-duplicates
> 
> This fixes my first point...
> 
> > +                   (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)))))
> 
> ...and it means it is walking more than needed.  Therefore, what is
> the performance loss?
> 
> For instance, on my machine and hot cache, it is 4x slower.

FWIW, calling ./pre-inst-env guix ... will always be slower than guix ...,
because the former will have a longer %load-path (IIRC) and possibly
other reasons.

Using "guix pull --profile=..." "time .../guix import ..." might be a better test.

To only measure the time required for defiing 'importers', wrap delete-duplicates
in a call to 'time' from (ice-9 time).

Greetings,
Maxime.