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

Improve performance of pathlib.PurePath.match() #105113

Closed
barneygale opened this issue May 30, 2023 · 1 comment
Closed

Improve performance of pathlib.PurePath.match() #105113

barneygale opened this issue May 30, 2023 · 1 comment
Labels
3.12 bugs and security fixes performance Performance or resource usage topic-pathlib type-feature A feature request or enhancement

Comments

@barneygale
Copy link
Contributor

barneygale commented May 30, 2023

It should be possible to improve the performance of of pathlib.PurePath.match() in Python 3.12 by applying a version of the patch in #101398, but without support for recursive wildcards.

Linked PRs

@barneygale barneygale added type-feature A feature request or enhancement performance Performance or resource usage 3.12 bugs and security fixes topic-pathlib labels May 30, 2023
barneygale added a commit to barneygale/cpython that referenced this issue May 30, 2023
We now compile a `re.Pattern` object for the entire pattern. This is made
more difficult by `fnmatch` not treating directory separators as special
when evaluating wildcards (`*`, `?`, etc), and so we arrange the path parts
onto separate *lines* in a string, and ensure we don't set `re.DOTALL`.

Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
barneygale added a commit that referenced this issue May 31, 2023
…H-105114)

We now compile a `re.Pattern` object for the entire pattern. This is made
more difficult by `fnmatch` not treating directory separators as special
when evaluating wildcards (`*`, `?`, etc), and so we arrange the path parts
onto separate *lines* in a string, and ensure we don't set `re.DOTALL`.

Co-authored-by: Hugo van Kemenade <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
@barneygale
Copy link
Contributor Author

Addressed in 3.12 branch: e7cb216 / #105114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes performance Performance or resource usage topic-pathlib type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant