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

Ross Burton
2025-10-20T11:23:56Z

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.

Cheers,
Ross