-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
bootstrap/format: send larger batches to rustfmt #121781
Conversation
r? @clubby789 rustbot has assigned @clubby789. Use r? to explicitly pick a reviewer |
Did you try with |
This code quite deliberately honors On my system, available_parallelism is 20, so that just means we're no longer measuring what happens on low-core systems. |
@bors r+ rollup |
…llaumeGomez Rollup of 10 pull requests Successful merges: - rust-lang#118217 (Document which methods on `f64` are precise) - rust-lang#119748 (Increase visibility of `join_path` and `split_paths`) - rust-lang#121412 (platform docs: clarify hexagon-unknown-none-elf example, add hexagon-unknown-linux-musl) - rust-lang#121654 (Fix `async Fn` confirmation for `FnDef`/`FnPtr`/`Closure` types) - rust-lang#121700 (CFI: Don't compress user-defined builtin types) - rust-lang#121765 (add platform-specific function to get the error number for HermitOS) - rust-lang#121781 (bootstrap/format: send larger batches to rustfmt) - rust-lang#121788 (bootstrap: fix clap deprecated warnings) - rust-lang#121792 (Improve renaming suggestion when item starts with underscore) - rust-lang#121793 (Document which methods on `f32` are precise) r? `@ghost` `@rustbot` modify labels: rollup
The batch size was set to a small value because it might end up distributing work unevenly across rustfmt processes and thus lead to worse wall-time on many-core systems. Additionally, very little hardware with only a single core exists these days, so I think something like Have you tried smaller increments than jumping from 8 to 64? |
Rollup merge of rust-lang#121781 - RalfJung:bootstrap-fmt, r=clubby789 bootstrap/format: send larger batches to rustfmt This helps on systems with low core counts. To benchmark this I made a lot of files be modified: ``` for FILE in $(find compiler/ -name "*.rs"); do echo "// end of the file" >>$FILE; done ``` Then I ran ``` hyperfine "./x.py fmt -j1" -w 1 -r 4 ``` Before this patch: ``` Benchmark 1: ./x.py fmt -j1 Time (mean ± σ): 3.426 s ± 0.032 s [User: 4.681 s, System: 1.376 s] Range (min … max): 3.389 s … 3.462 s 4 runs ``` With this patch: ``` Benchmark 1: ./x.py fmt -j1 Time (mean ± σ): 2.530 s ± 0.054 s [User: 4.042 s, System: 0.467 s] Range (min … max): 2.452 s … 2.576 s 4 runs ```
Without
After:
I think in most cases it'll be much less than 63 files since the formatting workers will be draining the queue faster than the directory walker fills it. I haven't tried to measure that though.
I incremented it until there was no significant improvement with |
Ok, sounds good. |
Actually, how did you benchmark this? I'm currently looking at the bootstrap rustfmt code and its behavior depends on the git state. This can taint benchmark results. Edit, nevermind, I see you modified the files.
|
Please read the PR description, I described my benchmarking methodology. :) |
This helps on systems with low core counts. To benchmark this I made a lot of files be modified:
Then I ran
Before this patch:
With this patch: