Title: Speedup `posixpath.abspath()` for relative paths · Issue #117587 · python/cpython · GitHub
Open Graph Title: Speedup `posixpath.abspath()` for relative paths · Issue #117587 · python/cpython
X Title: Speedup `posixpath.abspath()` for relative paths · Issue #117587 · python/cpython
Description: Feature or enhancement Proposal: When normalising a relative path, we don't need to process the cwd as it's already normalised, which could get expensive if it's long: < _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *n...
Open Graph Description: Feature or enhancement Proposal: When normalising a relative path, we don't need to process the cwd as it's already normalised, which could get expensive if it's long: < _Py_normpath_and_size(wchar...
X Description: Feature or enhancement Proposal: When normalising a relative path, we don't need to process the cwd as it's already normalised, which could get expensive if it's long: < _Py_normpath...
Opengraph URL: https://github.com/python/cpython/issues/117587
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Speedup `posixpath.abspath()` for relative paths","articleBody":"# Feature or enhancement\r\n\r\n### Proposal:\r\n\r\nWhen normalising a relative path, we don't need to process the cwd as it's already normalised, which could get expensive if it's long:\r\n\r\n```diff\r\n\u003c _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)\r\n---\r\n\u003e _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t start, Py_ssize_t *normsize)\r\n2397a2398,2402\r\n\u003e return path;\r\n\u003e }\r\n\u003e // Start beyond end of path\r\n\u003e if (start \u003e= size) {\r\n\u003e *normsize = size;\r\n2457a2463,2467\r\n\u003e // Skip past cwd\r\n\u003e if (path + start \u003e p1) {\r\n\u003e p1 = p2 = path + start;\r\n\u003e lastC = *(p1-1);\r\n\u003e }\r\n2525c2535\r\n\u003c return _Py_normpath_and_size(path, size, \u0026norm_length);\r\n---\r\n\u003e return _Py_normpath_and_size(path, size, 0, \u0026norm_length);\r\n\r\n```\r\n\r\n### Has this already been discussed elsewhere?\r\n\r\nThis is a minor feature, which does not need previous discussion elsewhere\r\n\r\n### Links to previous discussion of this feature:\r\n\r\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-117855\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/nineteendo","@type":"Person","name":"nineteendo"},"datePublished":"2024-04-06T19:03:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":26},"url":"https://github.com/117587/cpython/issues/117587"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d426b3b9-da9c-fd62-12b9-d1c6bac5cf60 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDBA:12317A:7D0668:ABD16A:6A51FA07 |
| html-safe-nonce | 0e384cb667ab32c83441fbfea497f9b50c23ccaf445c0dbc58f6f4e5cf80189a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREJBOjEyMzE3QTo3RDA2Njg6QUJEMTZBOjZBNTFGQTA3IiwidmlzaXRvcl9pZCI6IjI3NzY4MTM0NTIzNDExNDgxNjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7c12a2efb67de3623ea4b72cec745b0ebc38c0eb3a3db325321f63649e00909a |
| hovercard-subject-tag | issue:2229367446 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/117587/issue_layout |
| twitter:image | https://opengraph.githubassets.com/259a29bbe0db70f0d3a9c921789ec4d35d698e007855a6969e3815e607698238/python/cpython/issues/117587 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/259a29bbe0db70f0d3a9c921789ec4d35d698e007855a6969e3815e607698238/python/cpython/issues/117587 |
| og:image:alt | Feature or enhancement Proposal: When normalising a relative path, we don't need to process the cwd as it's already normalised, which could get expensive if it's long: < _Py_normpath_and_size(wchar... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nineteendo |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width