Skip to content
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

Speed up tidy quite a lot #108772

Merged
merged 6 commits into from
Mar 18, 2023
Merged

Speed up tidy quite a lot #108772

merged 6 commits into from
Mar 18, 2023

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Mar 5, 2023

I highly recommend reviewing this commit-by-commit. Based on #106440 for convenience.

Timings

These were collected by running x test tidy -v to copy paste the command, then using samply record.

before (8 threads)
image

after (8 threads) image

before (64 threads) image
after (64 threads) image

The last commit makes tidy use more threads, so comparing "before (8 threads)" to "after (64 threads)" is IMO the most realistic comparison. Locally, that brings the time for me to run tidy down from 4 to .9 seconds, i.e. the majority of the time for x test tidy is now spend running fmt --check.

r? @the8472

@jyn514 jyn514 marked this pull request as ready for review March 5, 2023 14:00
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 5, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 5, 2023
…rsan68

x fmt: Only check modified files locally

Previously, `x fmt` would only format modified files, while `x fmt .` and `x fmt --check` would still look at all files. After this change, `x fmt --check` only looks at modified files locally.

I feel pretty confident in this change - other than rust-lang#106261, no one has reported bugs in `get_modified_rs_files` since it was added in rust-lang#105702.

Combined with the changes in rust-lang#108772, this brings the time for me to run `x t tidy` with a hot FS cache down from 5 to 2 seconds (and moves the majority of the time spent back to `tidy check`, which means it can be sped up more in the future).
.gitignore Show resolved Hide resolved
src/bootstrap/test.rs Show resolved Hide resolved
@the8472 the8472 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2023
@rust-log-analyzer

This comment has been minimized.

This makes it easier to profile.
- Skip files in `skip` wherever possible to avoid reading their contents
- Don't look for `tidy-alphabetic-start` in tests. It's never currently used and slows the check down a lot.
- Add new `filter_not_rust` helper function
Previously, it would walk each directory twice: once in the main `Walk`
iterator, and once to count the number of entries in the directory. Now
it only walks each directory once.
This has a significant speedup for me locally, from about 1.3 seconds to
.9 seconds.
@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 18, 2023
@the8472
Copy link
Member

the8472 commented Mar 18, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 18, 2023

📌 Commit 675c4aa has been approved by the8472

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 18, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 18, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#107416 (Error code E0794 for late-bound lifetime parameter error.)
 - rust-lang#108772 (Speed up tidy quite a lot)
 - rust-lang#109193 (Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests)
 - rust-lang#109234 (Tweak implementation of overflow checking assertions)
 - rust-lang#109238 (Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty)
 - rust-lang#109283 (rustdoc: reduce allocations in `visibility_to_src_with_space`)
 - rust-lang#109287 (Use `size_of_val` instead of manual calculation)
 - rust-lang#109288 (Stabilise `unix_socket_abstract`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ebf2cd into rust-lang:master Mar 18, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 18, 2023
@jyn514 jyn514 deleted the faster-tidy branch March 18, 2023 15:10
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 23, 2023
…yn514,ozkanonur

Don't skip all directories when tidy-checking

This fixes a regression from rust-lang#108772 which basically made it that tidy style checks only `README.md` and `COMPILER_TESTS.md`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2023
Don't skip all directories when tidy-checking

This fixes a regression from rust-lang#108772 which basically made it that tidy style checks only `README.md` and `COMPILER_TESTS.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants