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

optimize recursive glob matching (globstar) in simple cases #751

Open
sekiguchi-nagisa opened this issue Feb 26, 2024 · 2 comments
Open
Assignees
Labels
Core core language related issues enhancement

Comments

@sekiguchi-nagisa
Copy link
Owner

sekiguchi-nagisa commented Feb 26, 2024

in simple case (not contains . and .., only follow single path element by double star), iterate whole child directories and match these paths with glob pattern
(in naive globstar implementation, recursively call normal glob function, so opendir is called N^2 times of path depth)

see python/cpython#102613

@sekiguchi-nagisa sekiguchi-nagisa added enhancement Core core language related issues labels Feb 26, 2024
@sekiguchi-nagisa sekiguchi-nagisa self-assigned this Feb 26, 2024
@sekiguchi-nagisa
Copy link
Owner Author

optimized recursive glob matching can be implemented like the following
see (https://www.codeproject.com/Articles/5163931/Fast-String-Matching-with-Wildcards-Globs-and-Giti)

@sekiguchi-nagisa
Copy link
Owner Author

sekiguchi-nagisa commented Feb 27, 2024

should optimize the following pattern

echo **/**/*.png

@sekiguchi-nagisa sekiguchi-nagisa added this to the v0.35.0 milestone Jun 19, 2024
@sekiguchi-nagisa sekiguchi-nagisa removed this from the v0.35.0 milestone Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core core language related issues enhancement
Projects
None yet
Development

No branches or pull requests

1 participant