Subject: Re: [bug#57788] [PATCH] gnu: rust: Disable debug info to reduce build requirements

From: Efraim Flashner <[email-masked]>
Date: Fri, 7 Oct 2022 13:36:08 +0300

On Tue, Sep 13, 2022 at 07:56:46PM -0400, Mark H Weaver wrote:
> The following patch, which I've tested only on my private branch of
> Guix, dramatically reduces the amount of memory and time required to
> build Rust.
> 
> With this patch applied, I'm able to build Rust on a Thinkpad X200 with
> only 4 GB of RAM using both cores.  Without it, I'm unable to build Rust
> at all, even with parallel builds disabled, running in a bare text-only
> terminal, and with every nonessential daemon stopped.  When I tried, a
> single compiler process used more than 9 GB of virtual memory with heavy
> thrashing before the OOM killer finally put it out of its misery.

Your x200 is an x86_64? How much RAM+swap did you end up using with this
patch? I was going to point you to a patch upstream in mrustc but I
can't find it now, where they disabled debug builds by default, but I
can't find it now.

> Moreover, with this patch the builds are dramatically faster than I've
> previously observed.  In my earlier bootstraps of Rust (up to
> rust-1.51), it took about 5 hours to build each compiler on my machine.
> Now it takes only about 2 hours per compiler, except for the initial
> bootstrap (1.54) which takes about 4 hours.

I tested it out on my machine, it brought the build time down from 101
minutes to 71 minutes. Not the same improvement, but still noticeable.

> The following patch is meant to be applied to the 'staging' branch, but
> I've only tested it on my own private branch, which is based on very old
> 'master' (April 2021) and is thus quite different by now.
> 
> I offer it here in case it might be of interest, although it hasn't been
> tested on contemporary Guix.  I'm not subscribed to this mailing list,
> so please make sure to CC me on any replies you'd like me to see.
> 
>      Regards,
>        Mark

I'm building out to librsvg on staging right now with this patch
applied, so hopefully we'll see that it's good.

I'm assuming that setting CARGO_PROFILE_DEV_DEBUG to false won't cause
any problems.

-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted