-
Notifications
You must be signed in to change notification settings - Fork 5
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
Walk the path backwards when creating new directories #1057
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
rydrman
force-pushed
the
reduced-steps-makedir-with-perms
branch
2 times, most recently
from
June 21, 2024 22:02
b1ed27b
to
1ec44c3
Compare
Not sure exactly what changed with the integration tests here but I will chase it |
rydrman
force-pushed
the
reduced-steps-makedir-with-perms
branch
2 times, most recently
from
June 21, 2024 23:13
85e8fea
to
1b88abe
Compare
jrray
reviewed
Jun 22, 2024
rydrman
force-pushed
the
eaccess-on-fedora
branch
2 times, most recently
from
June 22, 2024 15:17
961ce75
to
0a6f428
Compare
Our original algorithm walked down from the root, creating directories as needed. This creates an operation of O(n) under all scenarios, where n is the number of path components. However, we can generally assume that these paths are going to be created once and then already exist from that point forward. This mean that for a vast majority of the operations, we are over-checking. This new system walks up from the full path, checking each entry and tracking which do not exist. Once it finds an existing parent, it walks back down creating each item. In a worst case scenario, this becomes an O(2n) operation but changes our best-case to an O(1). Eg if the path already exists, a single lstat call confirms this and nothing else needs to be done. This feels like a desirable trade-off given that most operations are likely to fall into the "already exists" bucket. Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
rydrman
force-pushed
the
reduced-steps-makedir-with-perms
branch
from
June 22, 2024 15:17
c1ba84e
to
fcd7e60
Compare
@jrray FYI I'm not sure if you are planning to review this again since we talked about it... |
jrray
approved these changes
Jul 14, 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.
Did I never approve it? Sorry about that.
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.
Our original algorithm walked down from the root, creating directories as needed. This creates an operation of O(n) under all scenarios, where n is the number of path components. However, we can generally assume that these paths are going to be created once and then already exist from that point forward. This mean that for a vast majority of the operations, we are over-checking. This new system walks up from the full path, checking each entry and tracking which do not exist. Once it finds an existing parent, it walks back down creating each item. In a worst case scenario, this becomes an O(2n) operation but changes our best-case to an O(1). Eg if the path already exists, a single lstat call confirms this and nothing else needs to be done. This feels like a desirable trade-off given that most operations are likely to fall into the "already exists" bucket.