-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Special case for "" & "." in posixpath.abspath()
#117639
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
Comments
How often does real code call |
This speeds up |
I see. That would be useful information to edit into the issue description. |
posixpath.abspath()
posixpath.abspath()
How much is that speedup? According to your PR there is no speedup for the general call with one argument. |
I'll do a benchmark soon. The pull request currently doesn't compare the performance of |
This special case makes |
Hmm. In my opinion, this particular optimisation is not worth it for a speedup of that magnitude. The refactor makes the code of this function look quite odd (the kind of thing that somebody keen on "refactoring" or "simplifying" the code of |
OK, I was planning for a larger speedup anyway, that would apply to all relative paths: #117587. |
Feature or enhancement
Proposal:
We could add a special case for the current directory and return it without normalising. This speeds up
posixpath.relpath()
with one argument.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
os.path
#117610Linked PRs
posixpath.abspath()
#117640The text was updated successfully, but these errors were encountered: