From: Maxime Devos <maximedevos@telenet.be>
To: pinoaffe <pinoaffe@airmail.cc>
Cc: 50755@debbugs.gnu.org, zimoun <zimon.toutoune@gmail.com>
Subject: [bug#50755] [PATCH v3] import: Generate list of importers based on available modules
Date: Thu, 30 Sep 2021 10:37:17 +0200 [thread overview]
Message-ID: <b49ef3ad39319d3d9057b1a69c62dee2c0ce1bbb.camel@telenet.be> (raw)
In-Reply-To: <87r1d6zdcj.fsf@airmail.cc>
[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]
pinoaffe schreef op do 30-09-2021 om 10:17 [+0200]:
> Maxime Devos writes:
> > These numbers turn out to be misleading, because 'scheme-modules'
> > (indirectly called from all-modules) calls 'resolve-interface' on every module
> > name. For a module name, the first 'resolve-module' incurs disk I/O and some
> > CPU for loading the module, but the second 'resolve-module' on the same module
> > name would be free, as the module is already loaded.
> okay, the first incantation of
>
> (time (for-each (lambda (_)
> (delete-duplicates (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)))))
> (iota 1)))
>
> on a "fresh" guix repl on my system results in
>
> clock utime stime cutime cstime gctime
> 1.28 0.76 0.13 0.00 0.00 0.16
On my fresh guix repl, it's a bit longer:
clock utime stime cutime cstime gctime
9.54 1.79 0.31 0.00 0.00 0.53
(9 or 10 seconds)
If I restart the guix repl and run it again,
I get about half a second:
clock utime stime cutime cstime gctime
0.47 0.57 0.02 0.00 0.00 0.19
> which is indeed a significant amount of time, though I don't think it'd
> be much of an issue considering that it's not likely that users will run
> lots of `guix import` shell commands in rapid succession.
The list of importers is only needed for two purposes, right?
1. to print a list of importers when "guix import --help" is run
2. to verify the string actually specifies an importer
Then 'guix import SOME-IMPORTER STUFF' could be optimised:
reolve-importer and guix-import could be modified to skip the validation
step and let resolve-importer print the error if the module couldn't be
found. Possibly (resolve-module '(the possibly undefined module) #:ensure #f)
might be useful. Then 'importers' would only be required for purpose (1),
so it could be wrapped in a promise, such that if "guix import some-importer stuff"
is called, only the required importer module is loaded.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2021-09-30 8:38 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b49ef3ad39319d3d9057b1a69c62dee2c0ce1bbb.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=50755@debbugs.gnu.org \
--cc=pinoaffe@airmail.cc \
--cc=zimon.toutoune@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.