Repository navigation
Avoid traversing excluded ancestors in shallow memory finds - #2318
Open
Mohamedajab wants to merge 1 commit into
Open
Mohamedajab wants to merge 1 commit into
Mohamedajab wants to merge 1 commit into
Conversation
Signed-off-by: Mohamed Ajab <mohamedajab8@gmail.com>
This file contains hidden or 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
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.
With
MemoryFileSystem.find(maxdepth=1, withdirs=True), deeply nested paths still makeadd_ancestor_dirsvisit and slice every excluded ancestor. Start from the deepest ancestor allowed bymaxdepth, then use the existing collection logic. This also handles directories implied by files and explicitly created empty directories.Refs #1906. The change improves shallow
findcalls; it does not replace the flat memory store or changewalk/ls.Validation on Windows, CPython 3.14:
git diff --checkpassed.Synthetic benchmark: 1,000 files sharing a deep parent, searching
/datawithmaxdepth=1, withdirs=True; median of five calls, with equal results checked. At depths 20/100/300, upstream took 0.0110/0.0971/0.5044 seconds and this patch took 0.0010/0.0016/0.0026 seconds. This measures that shallow, deep-path case rather than general filesystem speed.To reproduce timings on either revision: