diff mbox series

rust: Enable parallel-frontend-threads

Message ID 20260312040703.1487119-1-sundeep.kokkonda@windriver.com
State Changes Requested
Headers show
Series rust: Enable parallel-frontend-threads | expand

Commit Message

Sundeep KOKKONDA March 12, 2026, 4:07 a.m. UTC
From: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>

Enabled the parallel-frontend-threads for faster compilation of rust code.

Test Results:
A few tests ran by, with and without enabling this option.
- Avg. default build time (w/o this option) - 56m 50.104s
- Avg. build time with this option - 49m 17.224s
- Performance Difference - 7m 32.880s faster builds (≈ 13.3%)

Tests were performed by setting thread count as 8 & 16 but no much difference is seen.
So, the parallel-frontend-threads = 8 is set.

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
---
 meta/recipes-devtools/rust/rust_1.94.0.bb | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexander Kanavin March 12, 2026, 9:02 a.m. UTC | #1
On Thu, 12 Mar 2026 at 05:07, Sundeep KOKKONDA via
lists.openembedded.org
<sundeep.kokkonda=windriver.com@lists.openembedded.org> wrote:
> Test Results:
> A few tests ran by, with and without enabling this option.
> - Avg. default build time (w/o this option) - 56m 50.104s
> - Avg. build time with this option - 49m 17.224s
> - Performance Difference - 7m 32.880s faster builds (≈ 13.3%)
>
> Tests were performed by setting thread count as 8 & 16 but no much difference is seen.
> So, the parallel-frontend-threads = 8 is set.

It would really help to provide specifics. What tests did you run, and
how were the numbers obtained? How can these tests be reproduced? What
CPU was used and how many cores it had?

> +    config.set("rust", "parallel-frontend-threads", "8")

I'd suggest we don't hardcode a number, but rather set to oe.utils.cpu_count()
(grep oe-core for examples).

Alex
Richard Purdie March 12, 2026, 12:13 p.m. UTC | #2
On Thu, 2026-03-12 at 10:02 +0100, Alexander Kanavin via lists.openembedded.org wrote:
> On Thu, 12 Mar 2026 at 05:07, Sundeep KOKKONDA via
> lists.openembedded.org
> <sundeep.kokkonda=windriver.com@lists.openembedded.org> wrote:
> > Test Results:
> > A few tests ran by, with and without enabling this option.
> > - Avg. default build time (w/o this option) - 56m 50.104s
> > - Avg. build time with this option - 49m 17.224s
> > - Performance Difference - 7m 32.880s faster builds (≈ 13.3%)
> > 
> > Tests were performed by setting thread count as 8 & 16 but no much difference is seen.
> > So, the parallel-frontend-threads = 8 is set.
> 
> It would really help to provide specifics. What tests did you run, and
> how were the numbers obtained? How can these tests be reproduced? What
> CPU was used and how many cores it had?
> 
> > +    config.set("rust", "parallel-frontend-threads", "8")
> 
> I'd suggest we don't hardcode a number, but rather set to oe.utils.cpu_count()
> (grep oe-core for examples).

oe.utils.parallel_make() might make more sense here?

Cheers,

Richard
Sundeep KOKKONDA March 12, 2026, 1:11 p.m. UTC | #3
On 12-Mar-26 14:32, Alexander Kanavin wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Thu, 12 Mar 2026 at 05:07, Sundeep KOKKONDA via
> lists.openembedded.org
> <sundeep.kokkonda=windriver.com@lists.openembedded.org> wrote:
>> Test Results:
>> A few tests ran by, with and without enabling this option.
>> - Avg. default build time (w/o this option) - 56m 50.104s
>> - Avg. build time with this option - 49m 17.224s
>> - Performance Difference - 7m 32.880s faster builds (≈ 13.3%)
>>
>> Tests were performed by setting thread count as 8 & 16 but no much difference is seen.
>> So, the parallel-frontend-threads = 8 is set.
> It would really help to provide specifics. What tests did you run, and
> how were the numbers obtained? How can these tests be reproduced? What
> CPU was used and how many cores it had?

I tested the rust build time with `time bitbake rust` (I wonder how I 
missed this to put is commit msg)

Machine Info: Intel(R) Xeon(R) CPU E5-4669 v3 @ 2.10GHz with 144 CPUs.

>
>> +    config.set("rust", "parallel-frontend-threads", "8")
> I'd suggest we don't hardcode a number, but rather set to oe.utils.cpu_count()
> (grep oe-core for examples).

I choose 8 here as there is no noticeable difference between 8/16. Also, the rust blog says (https://blog.rust-lang.org/2023/11/09/parallel-rustc/) -

/We recommend eight threads because this is the configuration we have 
tested the most and it is known to give good results. Values lower than 
eight will see smaller benefits, but are appropriate if your hardware 
has fewer than eight cores. Values greater than eight will give 
diminishing returns and may even give worse performance. /
Thanks,
Sundeep K

>
> Alex
Richard Purdie March 12, 2026, 1:21 p.m. UTC | #4
On Thu, 2026-03-12 at 18:41 +0530, Sundeep KOKKONDA wrote:
> > 
> > I'd suggest we don't hardcode a number, but rather set to
> > oe.utils.cpu_count()
> > (grep oe-core for examples).
> >   
> I choose 8 here as there is no noticeable difference between 8/16.
> Also, the rust blog says
> (https://blog.rust-lang.org/2023/11/09/parallel-rustc/) - 
> 
> We recommend eight threads because this is the configuration we have
> tested the most and it is known to give good results. Values lower
> than eight will see smaller benefits, but are appropriate if your
> hardware has fewer than eight cores. Values greater than eight will
> give diminishing returns and may even give worse performance.

That sounds like min(oe.utils.parallel_make(), 8) then?

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rust/rust_1.94.0.bb b/meta/recipes-devtools/rust/rust_1.94.0.bb
index 2be0bd8d89..82f42b7f50 100644
--- a/meta/recipes-devtools/rust/rust_1.94.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.94.0.bb
@@ -139,6 +139,7 @@  python do_configure() {
     config.set("rust", "llvm-tools", e(False))
     config.set("rust", "lld", e(False))
     config.set("rust", "use-lld", e(False))
+    config.set("rust", "parallel-frontend-threads", "8")
     config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}")))
 
     # Whether or not to optimize the compiler and standard library