GNU bug report logs - #45893
[PATCH 0/2] DRAFT: Hint for options.

Previous Next

Package: guix-patches;

Reported by: zimoun <zimon.toutoune <at> gmail.com>

Date: Fri, 15 Jan 2021 16:38:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 45893 <at> debbugs.gnu.org
Subject: [bug#45893] [PATCH 0/2] DRAFT: Hint for options.
Date: Tue, 26 Jan 2021 22:00:35 +0100
zimoun <zimon.toutoune <at> gmail.com> skribis:

> Well, one question is: what is the status of Stream in Guile?  Without
> drifting the initial topic, I am interested by  the answer because it
> could be useful for “guix git log” (avoid to traverse all the history
> tree before displaying but traverse when it is required, somehow).

As discussed on IRC, there’s (srfi srfi-41).

> (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?  :-)

> 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:

--8<---------------cut here---------------start------------->8---
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.
--8<---------------cut here---------------end--------------->8---

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?

> 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.  :-)

Thanks,
Ludo’.




This bug report was last modified 4 years and 106 days ago.

Previous Next


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