Title: GH-115060: Speed up `pathlib.Path.glob()` by skipping directory scanning by barneygale · Pull Request #116152 · python/cpython · GitHub
Open Graph Title: GH-115060: Speed up `pathlib.Path.glob()` by skipping directory scanning by barneygale · Pull Request #116152 · python/cpython
X Title: GH-115060: Speed up `pathlib.Path.glob()` by skipping directory scanning by barneygale · Pull Request #116152 · python/cpython
Description: For ordinary literal pattern segments (e.g. foo/bar in foo/bar/../**), skip calling scandir() on each segment, and instead call exists() or is_dir() as necessary to exclude missing paths. This only applies when case_sensitive is None (the default); otherwise we can't guarantee case sensitivity or realness with this approach. If follow_symlinks is False we also need to exclude symlinks from intermediate segments. This restores an optimization that was removed in da1980a by some eejit. It's actually even faster because we don't stat() intermediate directories, and in some cases we can skip all filesystem access when expanding a literal part (e.g. when it's followed by a non-recursive wildcard segment). Issue: gh-115060
Open Graph Description: For ordinary literal pattern segments (e.g. foo/bar in foo/bar/../**), skip calling scandir() on each segment, and instead call exists() or is_dir() as necessary to exclude missing paths. This only...
X Description: For ordinary literal pattern segments (e.g. foo/bar in foo/bar/../**), skip calling scandir() on each segment, and instead call exists() or is_dir() as necessary to exclude missing paths. This only...
Opengraph URL: https://github.com/python/cpython/pull/116152
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:5e0cf56b-c460-cb3d-653a-3fc9a0e50a3e |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | B038:1D772C:12988F3:18D9305:696AD886 |
| html-safe-nonce | 711c26446d6d8ad35599fb115be1120dee84e9dcdbb08a63e87bfc3b1bbcdf72 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDM4OjFENzcyQzoxMjk4OEYzOjE4RDkzMDU6Njk2QUQ4ODYiLCJ2aXNpdG9yX2lkIjoiNjk3MjE3MDg5NjEzNDU1OTg3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5bc4d3b87b3b3a4dac7098bdb5f73da8dcaecf3eabe61350f07c889845911bf2 |
| hovercard-subject-tag | pull_request:1750520883 |
| 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/116152/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 | For ordinary literal pattern segments (e.g. foo/bar in foo/bar/../**), skip calling scandir() on each segment, and instead call exists() or is_dir() as necessary to exclude missing paths. This only... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 524a93f2c1f36522a3b4be4c110467ee4172245d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width