Title: Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True) · Issue #102613 · python/cpython · GitHub
Open Graph Title: Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True) · Issue #102613 · python/cpython
X Title: Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True) · Issue #102613 · python/cpython
Description: Bug report Pathlib.rglob can be orders of magnitudes slower than glob.glob(recursive=True) With a 1000-deep nested directory, glob.glob and Path.glob both took under 1 second. Path.rglob took close to 1.5 minutes. import glob import os f...
Open Graph Description: Bug report Pathlib.rglob can be orders of magnitudes slower than glob.glob(recursive=True) With a 1000-deep nested directory, glob.glob and Path.glob both took under 1 second. Path.rglob took close...
X Description: Bug report Pathlib.rglob can be orders of magnitudes slower than glob.glob(recursive=True) With a 1000-deep nested directory, glob.glob and Path.glob both took under 1 second. Path.rglob took close...
Opengraph URL: https://github.com/python/cpython/issues/102613
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Path.rglob performance issues in deeply nested directories compared to glob.glob(recursive=True)","articleBody":"# Bug report\r\n\r\nPathlib.rglob can be orders of magnitudes slower than `glob.glob(recursive=True)`\r\n\r\nWith a 1000-deep nested directory, `glob.glob` and `Path.glob` both took under 1 second. `Path.rglob` took close to 1.5 minutes.\r\n\r\n```python\r\nimport glob\r\nimport os\r\nfrom pathlib import Path\r\n\r\nx = \"\"\r\nfor _ in range(1000):\r\n x += \"a/\"\r\n os.mkdir(x)\r\n \r\n# ~ 0.5s\r\nprint(glob.glob(\"**/*\", recursive=True))\r\n\r\n# ~ 87s\r\nprint(list(Path(\".\").rglob(\"**/*\")))\r\n```\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104244\n* gh-104373\n* gh-104512\n* gh-105744\n* gh-105749\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/ionite34","@type":"Person","name":"ionite34"},"datePublished":"2023-03-11T23:29:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/102613/cpython/issues/102613"}
| 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:b534626c-2816-17b9-04d4-c02ae2a3819e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C6CE:312298:6F188:9922A:69695102 |
| html-safe-nonce | bc5b78b885657a349d8af22415b5ab1892755a8c9e0d0fd17411ff5e150c1414 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkNFOjMxMjI5ODo2RjE4ODo5OTIyQTo2OTY5NTEwMiIsInZpc2l0b3JfaWQiOiI1MTg2MTEyMzQwOTgwNDg2NDAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b682c14a30d2f236f4f9760ea2b72640a8c23f65e8251b567c345eeb9a9cbe84 |
| hovercard-subject-tag | issue:1620177013 |
| 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/102613/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a6d24736514a244af126bccf9c1aaf5e0ccd499476e5d29f365f767c39b07a49/python/cpython/issues/102613 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a6d24736514a244af126bccf9c1aaf5e0ccd499476e5d29f365f767c39b07a49/python/cpython/issues/102613 |
| og:image:alt | Bug report Pathlib.rglob can be orders of magnitudes slower than glob.glob(recursive=True) With a 1000-deep nested directory, glob.glob and Path.glob both took under 1 second. Path.rglob took close... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ionite34 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| 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 | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width