Title: GH-119169: Slightly speed up `os.walk(topdown=True)` by barneygale · Pull Request #121431 · python/cpython · GitHub
Open Graph Title: GH-119169: Slightly speed up `os.walk(topdown=True)` by barneygale · Pull Request #121431 · python/cpython
X Title: GH-119169: Slightly speed up `os.walk(topdown=True)` by barneygale · Pull Request #121431 · python/cpython
Description: When os.walk() traverses into subdirectories in top-down mode, call os.path.join() once to add a trailing slash, and use string concatenation thereafter to generate child paths. (this trick is already used in os.fwalk()) $ ./python -m timeit -s 'import os' 'list(os.walk("."))' 5 loops, best of 5: 41.4 msec per loop 5 loops, best of 5: 40.7 msec per loop # --> 1.7% faster Issue: gh-119169
Open Graph Description: When os.walk() traverses into subdirectories in top-down mode, call os.path.join() once to add a trailing slash, and use string concatenation thereafter to generate child paths. (this trick is alre...
X Description: When os.walk() traverses into subdirectories in top-down mode, call os.path.join() once to add a trailing slash, and use string concatenation thereafter to generate child paths. (this trick is alre...
Opengraph URL: https://github.com/python/cpython/pull/121431
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:b37855d3-474c-9412-81e8-93e5dcccc48f |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9DBE:2C4B08:84D9B1:B38AF7:6969DF80 |
| html-safe-nonce | a65ea5f557db452c5614464b86837ee09e94c857b7f3956608825c1f8ac18193 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REJFOjJDNEIwODo4NEQ5QjE6QjM4QUY3OjY5NjlERjgwIiwidmlzaXRvcl9pZCI6IjY5MTg1NTExMDI3NzcwNTcxNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4f2ca0c5b158c1caa91e14bdf48b5dacfb71f934ef8d1194536e8b445fcdafb1 |
| hovercard-subject-tag | pull_request:1956028632 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/121431/files |
| 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 | When os.walk() traverses into subdirectories in top-down mode, call os.path.join() once to add a trailing slash, and use string concatenation thereafter to generate child paths. (this trick is alre... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width