Skip to content

Add serde-1.0.219-threads4 benchmark for the parallel frontend #2141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented May 28, 2025

I tried to compile a few of our benchmarks with -Zthreads=4 and serde got the largest improvement that I saw, even though it's quite short (~2s > ~1s). I would like to experiment with adding a benchmark with the parallel frontend, to see how well the monitoring works. It's a bit tricky in that icounts, cycles and task-clock are actually larger in the 4threads version, but wall-time is better. We'll see how well that works in practice, I guess.

Note that the collector currently has six CPU cores, that's why I used -Zthreads=4 as a conservative value.

$ hyperfine --warmup 0 --runs 2 --prepare "rm -rf target" "cargo +nightly build" "RUSTFLAGS='-Zthreads=4' cargo +nightly build"
Benchmark 1: cargo +nightly build
  Time (mean ± σ):      2.170 s ±  0.039 s    [User: 1.962 s, System: 0.385 s]
  Range (min … max):    2.143 s …  2.198 s    2 runs
 
Benchmark 2: RUSTFLAGS='-Zthreads=4' cargo +nightly build
  Time (mean ± σ):      1.249 s ±  0.079 s    [User: 2.528 s, System: 0.453 s]
  Range (min … max):    1.193 s …  1.304 s    2 runs
 
Summary
  RUSTFLAGS='-Zthreads=4' cargo +nightly build ran
    1.74 ± 0.11 times faster than cargo +nightly build

@Kobzol Kobzol requested a review from nnethercote May 28, 2025 08:39
@lqd
Copy link
Member

lqd commented May 28, 2025

The parallel front end is not even tested on CI so benchmarking may be a bit early?

@Kobzol
Copy link
Contributor Author

Kobzol commented May 28, 2025

It is definitely an experiment. If something goes wrong, it's on @saethlin (#t-compiler/parallel-rustc > Simple parallel benchmark in rustc-perf @ 💬)... 😆

@nnethercote
Copy link
Contributor

Seems fine except the 4threads in the name reads really strangely to me, probably because it's not a valid identifier. What about threads4 instead? That also matches -Zthreads=4 more closely.

@Kobzol Kobzol force-pushed the add-serde-1.0.219-4threads branch from 4290c0d to cd6a1ae Compare May 29, 2025 07:03
@Kobzol
Copy link
Contributor Author

Kobzol commented May 29, 2025

Sure, renamed to -threads4.

@Kobzol Kobzol changed the title Add serde-1.0.219-4threads benchmark for the parallel frontend Add serde-1.0.219-threads4 benchmark for the parallel frontend May 29, 2025
@Kobzol Kobzol force-pushed the add-serde-1.0.219-4threads branch from cd6a1ae to ee7fcd9 Compare May 29, 2025 07:03
@Kobzol
Copy link
Contributor Author

Kobzol commented May 29, 2025

Let's try and see what happens in practice. If this causes issues, we'll revert.

@Kobzol Kobzol merged commit c5a4a9e into rust-lang:master May 29, 2025
11 checks passed
@Kobzol Kobzol deleted the add-serde-1.0.219-4threads branch May 29, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants