Subject: [bug#53765] [PATCH v2 05/18] gnu: Add clojure-core-memoize.

From: Maxime Devos <[email-masked]>
Date: Sat, 19 Mar 2022 20:46:23 +0100

Reily Siegel schreef op za 19-03-2022 om 20:07 [+0100]:
> When I first started running into these issues, I reached out to Clojure
> maintainers on the Clojurians Slack, and the response was that AOT
> compilation is only meant for complete applications to reduce startup
> latency, not individual libraries.

That seems backwards to me.  Wouldn't AOTing compiling individual
libraries be more efficient than AOTing individual applications?
More concretely:

Suppose app A and B consists of a single source file A.clj and B.clj
respectively, and each have library C (with C.clj) as dependency.
Then, what Guix currently does, is AOT'ing C.lj when building C, then
AOT'ing A.clj when building A and AOT'ing B when building B.
In total, AOT'ing a file happens thrice here.

What seems to be implied here, is that the AOT'ing needs to be delayed
to A and B.  In this case, C.clj would be AOT'd twice: once for A, and
once for B.  In total, AOT'ing a file happens four times here.

As such, wouldn't AOT'ing the applications instead of the libraries be
less efficient?

An additional problem here is grafting.  If the AOT'ing was delayed to
the application packages, then the libraries cannot be grafted, for the
same reason that (C, C++, Go, ...) static libraries cannot be grafted.

Greetings,
Maxime.