unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <mail@ambrevar.xyz>
To: guix-devel@gnu.org
Subject: Reducing LLVM closure size
Date: Fri, 12 Jun 2020 11:06:32 +0200	[thread overview]
Message-ID: <87d064slev.fsf@ambrevar.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]

Since LLVM is all over the place, _multiple_ versions of LLVM inevitably
end up in anyone's graph.

Can we reduce its closure size?

--8<---------------cut here---------------start------------->8---
> guix size llvm
store item                                                       total    self
/gnu/store/118xpdazyylxa1rlc68h9lmh38vhxrb4-llvm-10.0.0            210.8   139.3  66.1%
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31              38.4    36.7  17.4%
/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib           71.0    32.6  15.5%
/gnu/store/mmhimfwmmidf09jw1plw3aw1g1zn2nkh-bash-static-5.0.16       1.6     1.6   0.8%
/gnu/store/rykm237xkmq7rl1p0nwass01p090p88x-zlib-1.2.11             71.2     0.2   0.1%
/gnu/store/bw15z9kh9c65ycc2vbhl2izwfwfva7p1-libffi-3.3              71.2     0.2   0.1%
total: 210.8 MiB
--8<---------------cut here---------------end--------------->8---

Let's look at what Arch Linux does:

- https://www.archlinux.org/packages/extra/x86_64/llvm/
- https://www.archlinux.org/packages/extra/x86_64/llvm-libs/
- https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/llvm

For the first 2 links, click on
"View the file list for ..." link at the bottom to display the file
list.

"bin" and "include" occupy some 35 MiB.  First thing we can do is split

- either move the libs to a "lib" output,
- or move the "bin" and "include" folder to a new output.

The second approach has the benefit of being less disruptive for dependents.

Now if we look at the PKGBUILD, there are some interesting compilation
flags.  If we remove

  "-DBUILD_SHARED_LIBS:BOOL=TRUE"

and add

  "-DLLVM_BUILD_LLVM_DYLIB=ON"
  "-DLLVM_LINK_LLVM_DYLIB=ON"

it will produce a single libLLVM-10.so library.  This reduces the "lib"
folder size from 107 MiB to 90 MiB.

All in all, it looks like we can save 52 MiB out of 140 MiB from the LLVM
package (and 210 MiB from its closure).

This would need a bit of testing since LLVM has many versions and many
dependents (a change to llvm-3 rebuilds 1000+ dependents).

By the way, this looks like a bug:

--8<---------------cut here---------------start------------->8---
> guix refresh -l llvm
Building the following package would ensure 3 dependent packages are rebuilt: clang-toolchain@10.0.0
--8<---------------cut here---------------end--------------->8---

Why is only 1 package displayed?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

             reply	other threads:[~2020-06-12  9:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12  9:06 Pierre Neidhardt [this message]
2020-06-12 12:01 ` Reducing LLVM closure size Julien Lepiller
2020-06-12 12:09   ` Oliver Propst
2020-06-12 13:19   ` Pierre Neidhardt
2020-06-12 13:34     ` Julien Lepiller
2020-06-12 14:13       ` Pierre Neidhardt
2020-06-13 12:28 ` Arun Isaac
2020-06-13 15:34   ` Pierre Neidhardt
2020-06-16  9:22 ` Ludovic Courtès
2020-06-16  9:27   ` Pierre Neidhardt
2020-06-16  9:45     ` Efraim Flashner
2020-06-16 10:11       ` Pierre Neidhardt
2020-07-07  8:49       ` Pierre Neidhardt
2020-06-23  8:41     ` Pierre Neidhardt
2020-06-28 20:30       ` Ludovic Courtès
2020-07-28 10:09         ` Pierre Neidhardt

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=87d064slev.fsf@ambrevar.xyz \
    --to=mail@ambrevar.xyz \
    --cc=guix-devel@gnu.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).