-
Notifications
You must be signed in to change notification settings - Fork 2.7k
clean: Optimize clean with multiple -p specifiers #16264
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
base: master
Are you sure you want to change the base?
Conversation
This commit optimizes implementation of `cargo clean -p` by reducing the amount of directory walks that take place. We now batch calls to `rm_rf_prefix_list`, thus potentially avoiding multiple walks over a single subdirectory. In practice this helps us significantly reduce the runtime for clearing large workspaces (as implemented in rust-lang#16263); for Zed, `cargo clean --workspace` went down from 73 seconds to 3 seconds. We have 216 workspace members. Co-authored-by: dino <[email protected]>
|
Have you tried out the performance of |
|
Are we really benefiting from all of this filesystem globbing? Should we just walk all of the content upfront, get it into a |
No, I did not try
I don't think we benefit much from globbing, particularly because most of it's use cases are about a simple prefix/suffix matching. I'm in the process of coalescing file walking further. I'll push that up to this branch before marking this PR as ready to review.
If we could make the pattern matching part straightforward (to read/maintain) then sure, that'd be best. I'm clinging onto the existing setup for no good reason; the end goal for me is to have a faster |
|
I am very happy to report that This PR is currently at 2.6s. I think we could reach a similar ballpark with the current build dir layout.. But obviously, this code will be removed at some point either way. |
|
☔ The latest upstream changes (possibly 2b48142) made this pull request unmergeable. Please resolve the merge conflicts. |
Co-authored-by: dino [email protected]
What does this PR try to resolve?
This commit optimizes implementation of
cargo clean -pby reducing the amount of directory walks that take place.We now batch calls to
rm_rf_prefix_list, thus potentially avoiding multiple walks over a single subdirectory. In practice this helps us significantly reduce the runtime for clearing large workspaces (as implemented in #16263); for Zed,cargo clean --workspacewent down from 73 seconds to 3 seconds.We have 216 workspace members.
How to test and review this PR?
We've tested it by hand, running it against
regex,ruffandzedcodebases.This PR is still marked as draft, as I don't love the code. I would also understand if y'all were against merging this, given that new build directory layout is in flight.