Subject: Re: bug#50349: [PATCH] packages: Add 'define-package' syntax.

From: Taylan Kammer <[email-masked]>
Date: Sat, 4 Sep 2021 23:01:07 +0200

On 04.09.2021 20:53, Sarah Morgensen wrote:

> 
> If you were really interested, I suppose you could test with compilation
> optimization off, but I'd be more interested in the performance impact
> with (guix packages) imported.
> 
> --
> Sarah
> 

Good questions.  Let's see.  Caching shouldn't be an issue by the way since
I always time a command several times and make sure it's consistent.

With -O0 and -O1, both files take a negligible amount of time to compile,
approximately 0.25s and 0.3s.  A difference of 0.5s for 512 packages means
about 0.001s per package, which at 100K packages would be 100s.

That's without importing (guix packages) though.  When I import it, then
at -O0 and -O1 (I think these are equivalent), the define-packages one
takes about 3.8s and the regular one about 3.5s.  So the difference has
actually shrunk down to about 0.3s now.

With (guix packages) and no special optimization flag, the define-packages
one takes about 26s, and the regular one still shows the strange behavior
where the time explodes to over a minute.

If I remember correctly though, Guix uses -O1 to compile packages anyway.

So all in all I *think* we can say that the macro induces no important
performance hit.  (And could for some reason significantly improve it if
we compile a large chunk of packages on -O2...)

One thing I should note though is that I'm using a top-of-the-line typical
consumer CPU (Ryzen 9 3900X) so on an older machine, or a CPU brand that
puts more value into freedom and security than performance, the results
may be different.  I still doubt that the impact would be big.

Attached are new scm files since I had to add some fields to make sure
the package macro from (guix packages) doesn't abort the compilation.

-- 
Taylan