Title: GH-101362: Omit path anchor from `pathlib.PurePath()._parts` by barneygale · Pull Request #102476 · python/cpython · GitHub
Open Graph Title: GH-101362: Omit path anchor from `pathlib.PurePath()._parts` by barneygale · Pull Request #102476 · python/cpython
X Title: GH-101362: Omit path anchor from `pathlib.PurePath()._parts` by barneygale · Pull Request #102476 · python/cpython
Description: Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the implementations of name, parent, and parents a little. Optimize _make_child_relpath() by building the new string path with naive string concatination rather than _format_parsed_parts(). Optimize __hash__() and __eq__() by referring to the unsplit case-normalized path. Optimize __lt__() etc by referring to the naively split case-normalized path (i.e. split on sep without consideration of anchor) The public parts tuple is unaffected. $ ./python -m timeit -s 'from pathlib import PureWindowsPath as P' 'P("C:/foo/bar.py")' 100000 loops, best of 5: 1.98 usec per loop # before 200000 loops, best of 5: 1.75 usec per loop # after Issue: gh-101362
Open Graph Description: Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the impl...
X Description: Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the impl...
Opengraph URL: https://github.com/python/cpython/pull/102476
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:ea57ce64-155c-dff1-a39a-11b1b0a4c25a |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | DB7C:178041:1A8D27E:247BE87:696AA651 |
| html-safe-nonce | 7ac267bdc245cf24ca2181930f92d43610c298e25244111b850048595100e05d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjdDOjE3ODA0MToxQThEMjdFOjI0N0JFODc6Njk2QUE2NTEiLCJ2aXNpdG9yX2lkIjoiMzQ3NjY0MDUyMTY2MjQwODI3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6f37edab7e325772238415af60831588a45443e4e151301119c6b87e5989bc75 |
| hovercard-subject-tag | pull_request:1264960957 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/python/cpython/pull/102476/checks |
| twitter:image | https://avatars.githubusercontent.com/u/960340?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/960340?s=400&v=4 |
| og:image:alt | Improve performance of path construction by skipping the addition of the path anchor (drive + root) to the internal _parts list. Rename this attribute to _tail for clarity. Also: Simplify the impl... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3eaf9b8cf1badcd7041a8ad480b9d9b28bea0ef1cc821ca9ff20f2cc7f4fe4b9 |
| 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 full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd9a979046e6382bd084e2bd873bf65f797125ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width