From: zimoun <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 45893@debbugs.gnu.org
Subject: [bug#45893] [PATCH 0/2] DRAFT: Hint for options.
Date: Tue, 26 Jan 2021 22:44:46 +0100 [thread overview]
Message-ID: <86o8hbid9t.fsf@gmail.com> (raw)
In-Reply-To: <87v9bjxvkc.fsf_-_@gnu.org> ("Ludovic Courtès"'s message of "Tue, 26 Jan 2021 22:00:35 +0100")
Hi,
On Tue, 26 Jan 2021 at 22:00, Ludovic Courtès <ludo@gnu.org> wrote:
> As discussed on IRC, there’s (srfi srfi-41).
I am playing with it. Thanks! :-)
>> (define (read-the-cache guess)
>> (map (lambda (name)
>> (identity name))
>> (fold-available-packages
>> (lambda* (name version result
>> #:key supported? deprecated?
>> #:allow-other-keys)
>> (if (and supported? (not deprecated?))
>> (cons name result)
>> result))
>> '())))
>
> Why ‘map’ here? :-)
Good question! Burn CPU? :-)
>> scheme@(guix-user)> ,time (define foo (read-the-cache "macs-mgit"))
>> ;; 3.492591s real time, 4.523108s run time. 1.530055s spent in GC.
>
> 3.5s?! I have:
>
> scheme@(guix-user)> ,use(gnu packages)
> scheme@(guix-user)> ,time (define lst (fold-available-packages
> (lambda* (name version result
> #:key supported? deprecated?
> #:allow-other-keys)
> (if (and supported? (not deprecated?))
> (cons name result)
> result))
> '()))
> ;;; <stdin>:2:6: warning: possibly unused local top-level variable `lst'
> ;; 0.093728s real time, 0.130037s run time. 0.065544s spent in GC.
>
> I assume you’re using ‘guix repl’ and the cache is authoritative,
> meaning that GUIX_PACKAGE_PATH is unset and there’s no ‘-L’ flag,
> right?
Yes. GUIX_PACKAGE_PATH unset and no ’-L’ flag. So, it should be worse
otherwise.
Well, I am surprise by the timing difference. I do not remember on
which machine I did: maybe an old desktop with spinning disks at work.
>> scheme@(guix-user)> ,profile (define foo (compute-distance "macs-mgit"))
>> % cumulative self
>> time seconds seconds procedure
>> 44.68 51.86 1.83 guix/memoization.scm:100:0
>> 17.55 0.72 0.72 hash-set!
>> 12.23 0.54 0.50 guix/utils.scm:863:2:mproc
>> 9.04 0.37 0.37 hash-ref
>
> OK, the naive memoizing implementation is inefficient, now we know. :-)
’memoize’ or ’mlambda’? Or both? Well, the thread is mess up to I do
not remember which one had been used.
On the other hand, the naive recursive edit distance is well know to be
slow and ineffective.
Cheers,
simon
next prev parent reply other threads:[~2021-01-26 21:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 16:37 [bug#45893] [PATCH 0/2] DRAFT: Hint for options zimoun
2021-01-15 16:39 ` [bug#45893] [PATCH 1/2] scripts: search, show: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-01-15 16:39 ` [bug#45893] [PATCH 2/2] guix: scripts: Add hint for option typo zimoun
2021-01-19 17:20 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-19 17:35 ` zimoun
2021-01-16 0:09 ` [bug#45893] [PATCH v2 0/3] DRAFT: Hint command line typo zimoun
2021-01-16 0:26 ` [bug#45893] [PATCH v2 1/3] scripts: search, show: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-01-16 0:26 ` [bug#45893] [PATCH v2 2/3] guix: scripts: Add hint for option typo zimoun
2021-01-19 17:31 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-16 0:26 ` [bug#45893] [PATCH v2 3/3] ui: Add command hint zimoun
2021-01-19 17:38 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-19 18:01 ` zimoun
2021-01-26 20:53 ` Ludovic Courtès
2021-01-26 21:27 ` zimoun
2021-01-19 23:59 ` [bug#45893] Hint for package name: too slow! zimoun
2021-01-20 9:49 ` [bug#45893] Hint for package name: full matrix iteration zimoun
2021-01-26 21:00 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-26 21:44 ` zimoun [this message]
2021-01-27 22:09 ` Ludovic Courtès
2021-01-19 21:28 ` [bug#45893] [PATCH v3 1/3] utils: Add string distance zimoun
2021-01-19 21:28 ` [bug#45893] [PATCH v3 2/3] guix: scripts: Add hint for option typo zimoun
2021-01-19 21:28 ` [bug#45893] [PATCH v3 3/3] ui: Add hint for command typo zimoun
2021-01-26 21:18 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-26 21:20 ` Ludovic Courtès
2021-01-26 22:05 ` zimoun
2021-02-03 11:28 ` bug#45893: " Ludovic Courtès
2021-02-03 12:15 ` [bug#45893] " zimoun
2021-02-24 23:47 ` option hint for all commands? zimoun
2021-03-01 14:07 ` Hartmut Goebel
2021-02-04 19:53 ` bug#46303: Typo helper doesn't always know which command is missing Leo Famulari
2021-02-04 21:29 ` zimoun
2021-02-04 23:08 ` [bug#45893] " 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=86o8hbid9t.fsf@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=45893@debbugs.gnu.org \
--cc=ludo@gnu.org \
/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.