From: "Ludovic Courtès" <ludo@gnu.org>
To: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Cc: 44254@debbugs.gnu.org
Subject: bug#44254: Performance of package input rewriting
Date: Sat, 31 Oct 2020 11:27:06 +0100 [thread overview]
Message-ID: <87tuuavgg5.fsf@gnu.org> (raw)
In-Reply-To: <20201030084245.GB3128@zpidnp36> (Lars-Dominik Braun's message of "Fri, 30 Oct 2020 09:42:45 +0100")
Hi Lars,
Lars-Dominik Braun <ldb@leibniz-psychology.org> skribis:
>> Another thing to look at is the <package> object graph (as show by ‘guix
>> graph’). Input rewriting can duplicate parts of the graph, which in
>> turn defeats package->derivation memoization. Just looking at the
>> number of nodes in the graph can give hints.
> Aha, it’s 913 nodes without rewriting, 13916 with rewriting (#:deep? #t) and
> 4286 with rewriting (#:deep? #f) as determined by a rather ad-hoc `guix graph
> -L . -t package python-jupyterlab | grep 'shape = box' | wc -l`. That seems way
> too much. Does that mean I’m using package rewriting in the wrong way or is
> that a bug?
It could be a mixture thereof. :-)
I guess it’s easy to end up creating huge object graphs. Here’s an
example of an anti-pattern:
(define a
((package-input-rewriting x) ((package-input-rewriting y) p1)))
(define b
((package-input-rewriting x) ((package-input-rewriting y) p2)))
The correct use is:
(define transform
(package-input-rewriting (append x y)))
(define a (transform p1))
(define b (transform p2))
That guarantees that ‘a’ and ‘b’ share most of the nodes of their object
graph.
From a quick look, the code in Guix-Science seemed to be following the
pattern above.
For example, there’s:
--8<---------------cut here---------------start------------->8---
(define python-ipykernel-5.3-bootstrap
(let ((rewritten ((package-input-rewriting
`((,python-jupyter-client . ,python-jupyter-client-6.1-bootstrap)
;; Indirect through IPython.
(,python-testpath . ,python-testpath-0.4)
(,python-nbformat . ,python-nbformat-5.0)))
python-ipykernel-5.3-proper)))
(package
(inherit rewritten)
(name "python-ipykernel-bootstrap"))))
(define-public python-jupyter-client-6.1
((package-input-rewriting
`((,python-ipykernel . ,python-ipykernel-5.3-bootstrap)
(,python-jupyter-core . ,python-jupyter-core-4.6)
;; Indirect through IPython.
(,python-testpath . ,python-testpath-0.4)
(,python-nbformat . ,python-nbformat-5.0)))
python-jupyter-client-6.1-proper))
(define-public python-ipykernel-5.3
((package-input-rewriting
`((,python-jupyter-client . ,python-jupyter-client-6.1)
;; Indirect through IPython.
(,python-testpath . ,python-testpath-0.4)
(,python-nbformat . ,python-nbformat-5.0)))
python-ipykernel-5.3-proper))
--8<---------------cut here---------------end--------------->8---
It seems to me that you’re redefining a dependency graph, node by node.
Thus, you probably don’t need ‘package-input-rewriting’ here. What you
did in Guix-Science commit 972795a23cc9eb5a0bb1a2ffb5681d151fc4d4b0
looks more appropriate to me, in terms of style and semantics.
Does that make sense?
Thanks,
Ludo’.
next prev parent reply other threads:[~2020-10-31 10:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 13:26 bug#44254: Performance of package input rewriting Lars-Dominik Braun
2020-10-27 14:14 ` zimoun
2020-10-28 14:19 ` Ludovic Courtès
2020-10-27 19:58 ` Ricardo Wurmus
2020-10-30 8:42 ` Lars-Dominik Braun
2020-10-31 10:27 ` Ludovic Courtès [this message]
2020-11-03 8:23 ` Lars-Dominik Braun
2020-11-03 9:32 ` Ludovic Courtès
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tuuavgg5.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=44254@debbugs.gnu.org \
--cc=ldb@leibniz-psychology.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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).