-
Notifications
You must be signed in to change notification settings - Fork 12
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
cli/delete-cache: Switch to fastwalk #90
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joebonrichie
force-pushed
the
faster-walk
branch
from
March 16, 2024 14:10
13ab35c
to
d9e193d
Compare
joebonrichie
changed the title
cli/delete-cache: Use parallelized version of filepath.Walk
cli/delete-cache: Go fast
Mar 16, 2024
joebonrichie
force-pushed
the
faster-walk
branch
5 times, most recently
from
March 16, 2024 20:56
457e1c4
to
85b1dfc
Compare
I see there are a couple of alternatives which have been maintained more recently: https://github.com/saracen/walker Will report back |
joebonrichie
changed the title
cli/delete-cache: Go fast
cli/delete-cache: Switch to fastwalk
Mar 20, 2024
joebonrichie
force-pushed
the
faster-walk
branch
from
March 20, 2024 14:55
0cb403f
to
33a60b7
Compare
@joebonrichie Appears to need a rebase. ^^' |
Keeps the same API usage, just faster. Resolves #89. solbuild dc -s ('41.8 GiB') Before : 0m15.849s (uncached) | 0m6.241s (cached) After : 0m2.134s (uncached) | 0m0.585s (cached)
Make use of the parallelized walk.Walk() function instead of RemoveAll() to remove files, this is significantly quicker. Additionally, get the directory size as we're deleting so we only run walk.Walk() once. Left over directories are still removed with RemoveAll() after all files have been deleted. If we could tweak the file walk to search depth first, we could append all directories to an array and then delete them with Remove() after all files have been removed which would be slightly faster. However, that is a micro optimization for the future. Before: 0m0.174s | Now: 0m0.081s (uncached, 720.1 MiB)
silkeh
approved these changes
Sep 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use a parallelized version to fileWalk to get directory sizes. Additionally, use the parallelized version of fileWalk to delete files, then call RemoveAll() on the remaining empty directories.
Resolves #89.
Benchmarks
solbuild dc -a (720.1 MiB)
Before: 0m0.174s | Now: 0m0.081s (uncached)
solbuild dc -s (41.8 GiB)
Before : 0m15.849s (uncached) | 0m6.241s (cached)
After : 0m2.134s (uncached) | 0m0.585s (cached)