Re: [OE-core] [PATCH V5 2/3] rust: Use llvm instead of rust-llvm

Khem Raj
2025-10-20T15:12:10Z

On Mon, Oct 20, 2025 at 7:40 AM Ross Burton via lists.openembedded.org
<ross.burton=arm.com@lists.openembedded.org> wrote:
>
> On 20 Oct 2025, at 12:23, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> >
> > Hi,
> >
> >> On 15 Oct 2025, at 10:59, Varatharajan, Deepesh via lists.openembedded.org <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote:
> >> Updated the Rust build to depend on llvm instead.
> >
> > Because I was curious, I looked at the build stats before and after this series being merged. Here are the diffs for cputime and walltime when I built llvm-native/rust-llvm-native and rust-native:
> >
> > PKG TASK ABSDIFF RELDIFF CPUTIME1 -> CPUTIME2
> > - rust-llvm-native do_compile -12241.8s -100.0% 12241.8s -> 0.0s
> > - rust-llvm-native do_unpack -31.4s -100.0% 31.4s -> 0.0s
> > - rust-llvm-native do_configure -9.4s -100.0% 9.4s -> 0.0s
> > - rust-llvm-native do_populate_sysroot -6.2s -100.0% 6.2s -> 0.0s
> > + llvm-project-source-21.1.3 do_patch 5.8s +inf% 0.0s -> 5.8s
> > rust-native do_populate_sysroot 9.5s +323.0% 2.9s -> 12.5s
> > + llvm-native do_configure 12.9s +inf% 0.0s -> 12.9s
> > + llvm-native do_populate_sysroot 18.6s +inf% 0.0s -> 18.6s
> > + llvm-project-source-21.1.3 do_unpack 20.0s +inf% 0.0s -> 20.0s
> > + llvm-tblgen-native do_configure 29.0s +inf% 0.0s -> 29.0s
> > + llvm-tblgen-native do_compile 593.1s +inf% 0.0s -> 593.1s
> > rust-native do_install 1724.2s +26.1% 6611.3s -> 8335.5s
> > + llvm-native do_compile 12051.6s +inf% 0.0s -> 12051.6s
> >
> > PKG TASK ABSDIFF RELDIFF WALLTIME1 -> WALLTIME2
> > - rust-llvm-native do_compile -401.1s -100.0% 401.1s -> 0.0s
> > - rust-llvm-native do_unpack -23.0s -100.0% 23.0s -> 0.0s
> > rust-native do_unpack -21.3s -42.5% 50.3s -> 28.9s
> > - rust-llvm-native do_configure -9.0s -100.0% 9.0s -> 0.0s
> > + llvm-project-source-21.1.3 do_unpack 7.0s +inf% 0.0s -> 7.0s
> > + llvm-native do_configure 12.3s +inf% 0.0s -> 12.3s
> > + llvm-tblgen-native do_configure 28.5s +inf% 0.0s -> 28.5s
> > + llvm-tblgen-native do_compile 30.1s +inf% 0.0s -> 30.1s
> > rust-native do_install 33.4s +6.0% 553.4s -> 586.8s
> > + llvm-native do_compile 378.0s +inf% 0.0s -> 378.0s
> >
> > For llvm vs rust-llvm, I’ve a local tweak to not build some of the GPU backends (as they take a long time) so it’s actually comparing like-for-like, and it’s good to see that the compile time is close. It’s slightly faster in llvm even though it’s building more backends, so I’m glad my build tweaking was useful.
> >
> > However, rust-native takes 26% more cpu time (just 6% more wall time, due to parallelisation). I’m wondering if this is fallout from using -Os instead of -O2, or something else about how we’re building rust-llvm vs llvm. Insights welcome, but I’ll likely fire a test build without -Os to see how that impacts the numbers later.
>
> Followup, comparing current master to master but with LLVM built as RelWithDebInfo instead of MinSizeRel:
>
> PKG TASK ABSDIFF RELDIFF CPUTIME1 -> CPUTIME2
> rust-native do_install -1690.4s -20.3% 8335.5s -> 6645.1s
> llvm-native do_compile 6081.7s +50.5% 12051.6s -> 18133.3s
>
> Cumulative cputime:
> 4117.4s +19.5% 5:52:36.1 (21156.1s) -> 7:01:13.5 (25273.5s)
>
>
> PKG TASK ABSDIFF RELDIFF WALLTIME1 -> WALLTIME2
> rust-native do_install 24.0s +4.1% 586.8s -> 610.8s
> llvm-native do_compile 238.9s +63.2% 378.0s -> 616.8s
>
> Cumulative walltime:
> 251.3s +22.8% 18:24.7 (1104.7s) -> 22:36.0 (1356.0s)
>
> So rust builds a bit faster, but LLVM is a lot slower to build, with a net result that the build is actually slower overall. I’m happy with the choice to use MinSizeRel in LLVM.

A large set of users of OE would not build compiler as often as some
system build engineers who build distros for them will do, so I wonder
how fast is resulting compiler in compiling applications, because in
such
settings it will be used in often and save a lot of time for users
such that spending extra time in compiling it in OE can be justified.
Of couse I am not recommending that
OE adopts that option as default.

>
> Ross
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225121): https://lists.openembedded.org/g/openembedded-core/message/225121
> Mute This Topic: https://lists.openembedded.org/mt/115768136/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>