From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Dependency cycle issues when using a Gexp-based snippet
Date: Wed, 16 Sep 2020 12:08:08 +0200 [thread overview]
Message-ID: <87v9geniev.fsf@gnu.org> (raw)
In-Reply-To: <87tuw047td.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 14 Sep 2020 12:55:10 -0400")
Hi,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>> What is the difference between delayed and thunked? Would a thunked
>>> capture the closure of its environment while delayed not? Is the
>>> closure useful to access record-bound values such as the version field
>>> of a package?
>>
>> ‘Thunk’ uses an actual thunk (zero-argument procedure) that’s called
>> each time the field is accessed; ‘delayed’ uses a promise, which is
>> similar except that the result is memoized (info "(guile) Delayed
>> Evaluation").
>
> Thanks for the explanation! Now I wonder why delayed should not always
> be preferable to thunks? Is there a reason to offer thunked as well?
Thunked fields were introduced pretty much as a hack so one could look
up dynamic bindings ‘%current-system’ and ‘%current-target-system’ and
produce a result that’s a function of that. (See
<https://hal.inria.fr/hal-00824004/en>.)
>> What would be interesting is a comparison of the performance of
>> ‘package-derivation’, which can be done with something like:
>>
>> time guix build -d --no-grafts libreoffice pandoc
>>
>> For memory consumption, try:
>>
>> GUIX_PROFILING=gc guix build -d --no-grafts libreoffice pandoc
>
> Thanks for these "benchmarking" tips :-). Unfortunately, making the
> 'snippet' field either thunked or delayed causes 'guix build' to stop
> working entirely, peaking the CPU and slowy eating RAM away (looks like
> a typical dependency cycle).
Hmm. In packages.scm, there’s a couple of places where <origin> are
matched directly, which means that you get to see the raw
thunk/promise. The solution is to explicitly call the thunk/force the
promise there, like we do for the ‘patches’ field in this clause:
($ <origin> uri method hash name (= force (patches ...)) snippet
(flags ...) inputs (modules ...) guile-for-build)
If that still doesn’t help, please send a patch! :-)
Ludo’.
next prev parent reply other threads:[~2020-09-16 10:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 2:10 Dependency cycle issues when using a Gexp-based snippet maxim.cournoyer
2020-08-24 21:09 ` Ludovic Courtès
2020-09-02 15:08 ` Maxim Cournoyer
2020-09-07 9:30 ` Ludovic Courtès
2020-09-14 16:55 ` Maxim Cournoyer
2020-09-16 10:08 ` Ludovic Courtès [this message]
2020-09-07 18:30 ` Mark H Weaver
2020-09-16 10:00 ` Ludovic Courtès
2020-09-08 4:07 ` What should "guix build --source" produce? (was Re: Dependency cycle issues when using a Gexp-based snippet) Mark H Weaver
2020-09-08 7:22 ` Andreas Enge
2020-09-11 18:22 ` Maxim Cournoyer
2020-09-11 18:42 ` zimoun
2020-09-11 20:40 ` Andreas Enge
2020-09-11 18:26 ` Maxim Cournoyer
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=87v9geniev.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=maxim.cournoyer@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 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).