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

Run rustfmt on batches of multiple files #7966

Merged
merged 3 commits into from
Nov 12, 2021

Conversation

Alexendoo
Copy link
Member

changelog: none

This gives cargo dev fmt a nice speed boost, down from 90s (because old) on my laptop and 120s (because windows) on my desktop to ~5s on both

250 at a time was to give windows a good amount of headroom (failed at ~800, rust-lang/rust#40384)

Also adds rustfmt to the toolchain file and has the clippy_dev workflow test using the pinned version as a follow up to #7963

@rust-highfive
Copy link

r? @camsteffen

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 12, 2021
@camsteffen
Copy link
Contributor

This was sorely needed, thanks! cargo dev fmt goes from 70s to 3.2s on my machine!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 12, 2021

📌 Commit 507030f has been approved by camsteffen

@bors
Copy link
Collaborator

bors commented Nov 12, 2021

⌛ Testing commit 507030f with merge cc9d7ff...

@flip1995
Copy link
Member

Wait it took so long for you? It was only at 10s on every machine for me, so I didn't bother looking into it. 😄 Thanks so much for this!

@camsteffen
Copy link
Contributor

I was surprised that it was that long. Has it gotten slower??

@bors
Copy link
Collaborator

bors commented Nov 12, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: camsteffen
Pushing cc9d7ff to master...

@bors bors merged commit cc9d7ff into rust-lang:master Nov 12, 2021
@Alexendoo
Copy link
Member Author

Now that you mention it the before numbers do seem a bit odd, I measured it after a rebase but it never felt like 2 minutes, more like 20-30s

@Alexendoo
Copy link
Member Author

Surprisingly it got slower in 24d561f. Looks like rustup takes ~100ms extra if you don't manually specify the toolchain, which adds up over lots of tests

Benchmark 1: rustfmt --version
  Time (mean ± σ):     130.3 ms ±   2.0 ms    [User: 4.7 ms, System: 5.9 ms]
  Range (min … max):   127.1 ms … 133.7 ms    21 runs

Benchmark 2: rustfmt +nightly-2021-11-04 --version
  Time (mean ± σ):      37.5 ms ±   1.5 ms    [User: 2.7 ms, System: 8.4 ms]
  Range (min … max):    34.5 ms …  41.9 ms    58 runs

@flip1995
Copy link
Member

Is this maybe a perf regression of rustfmt since 2021-11-04? Those numbers seem really high and would explain why it took up to 2 minutes.

@Alexendoo
Copy link
Member Author

I believe it's not on rustfmt's end, it happens with rustc as well, here on stable (with no override/rust-toolchain file around)

Benchmark 1: rustc --version
  Time (mean ± σ):     135.8 ms ±   2.8 ms    [User: 4.3 ms, System: 7.7 ms]
  Range (min … max):   131.7 ms … 143.7 ms    19 runs

Benchmark 2: rustc +stable --version
  Time (mean ± σ):      44.0 ms ±   2.3 ms    [User: 5.3 ms, System: 8.6 ms]
  Range (min … max):    40.4 ms …  51.4 ms    55 runs

I plan to take a better look tomorrow

@Alexendoo Alexendoo deleted the batch-rustfmt branch November 13, 2021 11:08
@Alexendoo
Copy link
Member Author

I think it's down to rust-lang/rustup#2626

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants