-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-111259: Optimize recursive wildcards in pathlib #111303
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
gh-111259: Optimize recursive wildcards in pathlib #111303
Conversation
Regular expression pattern `(?s:.)` is much faster than `[\s\S]`.
Is there a benchmark where this shows a clear improvement? I'm struggling to find one :/ I tried various simple benchmarks locally, such as
I've no doubt that |
You can ask the OP. I guess that you can see some difference in Simple example (in debug build):
With this PR:
|
Using a PGO-optimised build, I had to create an extremely long path for there to be a difference that wasn't just noise. But yeah, I can see a difference with this benchmark:
This PR:
|
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, though you may want to wait for @barneygale's feedback, since he knows the code here much better than me :)
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.
Looks fine to me, but perhaps worth noting that I'm intending to replace this code shortly - see #106703
That PR will only land in main
, but this PR could be backported to 3.12
I think?
…1303) Regular expression pattern `(?s:.)` is much faster than `[\s\S]`.
…1303) Regular expression pattern `(?s:.)` is much faster than `[\s\S]`.
Regular expression pattern
(?s:.)
is much faster than[\s\S]
.