Title: Potentially serious regression in garbage collector performance in Python 3.14 · Issue #139951 · python/cpython · GitHub
Open Graph Title: Potentially serious regression in garbage collector performance in Python 3.14 · Issue #139951 · python/cpython
X Title: Potentially serious regression in garbage collector performance in Python 3.14 · Issue #139951 · python/cpython
Description: Bug report Bug description: The following code, consisting of a bunch of dict lookups and writes, runs in < 1 second on Python 3.13 > 2 seconds on Python 3.14 n = 1000 d = {} for i in range(n): d[(i, i)] = d[(i, 0)] = d[(0, i)] = 0 for i...
Open Graph Description: Bug report Bug description: The following code, consisting of a bunch of dict lookups and writes, runs in < 1 second on Python 3.13 > 2 seconds on Python 3.14 n = 1000 d = {} for i in range(n): d[(...
X Description: Bug report Bug description: The following code, consisting of a bunch of dict lookups and writes, runs in < 1 second on Python 3.13 > 2 seconds on Python 3.14 n = 1000 d = {} for i in range(n...
Opengraph URL: https://github.com/python/cpython/issues/139951
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Potentially serious regression in garbage collector performance in Python 3.14","articleBody":"# Bug report\n\n### Bug description:\n\nThe following code, consisting of a bunch of `dict` lookups and writes, runs in\n\n* _\u003c 1 second_ on Python 3.13\n* _\u003e 2 seconds_ on Python 3.14\n \n```python\nn = 1000\nd = {}\nfor i in range(n):\n d[(i, i)] = d[(i, 0)] = d[(0, i)] = 0\nfor i in range(1, n):\n for j in range(1, n):\n d[(i, j)] = i + j + d[(i - 1, j)] + d[(i, j - 1)] + d[(i - 1, j - 1)]\nprint(d[(n - 1, n - 1)])\n```\n\nTests are run on a Dell Precision 5490, running Ubuntu:\n\n```\nLinux precision 6.14.0-33-generic #33-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 17 23:22:02 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux\n\nUbuntu 25.04 (Plucky)\n```\n\nThe cpython is from [python-build-standalone](https://github.com/astral-sh/python-build-standalone)\n\n* `cpython-3.14.0+20251010-x86_64-unknown-linux-gnu-install_only.tar.gz`\n* `cpython-3.13.8+20251010-x86_64-unknown-linux-gnu-install_only.tar.gz`\n\n\n## Log\n\n```\n[~/regression-testing]$ hyperfine --warmup=10 \"cp313/python/bin/python3.13 dicttest.py\" \"cp314/python/bin/python3.14 dicttest.py\"\nBenchmark 1: cp313/python/bin/python3.13 dicttest.py\n Time (mean ± σ): 880.8 ms ± 119.7 ms [User: 730.1 ms, System: 150.1 ms]\n Range (min … max): 713.3 ms … 1066.2 ms 10 runs\n \nBenchmark 2: cp314/python/bin/python3.14 dicttest.py\n Time (mean ± σ): 2.235 s ± 0.035 s [User: 2.066 s, System: 0.168 s]\n Range (min … max): 2.168 s … 2.295 s 10 runs\n \nSummary\n cp313/python/bin/python3.13 dicttest.py ran\n 2.54 ± 0.35 times faster than cp314/python/bin/python3.14 dicttest.py\n```\n\nIt seems to scale very poorly too. With the same code, but `n = 2000` (instead of `n = 1000`), leads to 3.3 sec (Python 3.13) vs 20 seconds (Python 3.14)! I.e., Python 3.13 being 5 times faster.\n\n```\n[~/regression-testing]$ hyperfine --warmup=10 \"cp313/python/bin/python3.13 dicttest.py\" \"cp314/python/bin/python3.14 dicttest.py\"\nBenchmark 1: cp313/python/bin/python3.13 dicttest.py\n Time (mean ± σ): 3.458 s ± 0.048 s [User: 2.889 s, System: 0.568 s]\n Range (min … max): 3.375 s … 3.521 s 10 runs\n \nBenchmark 2: cp314/python/bin/python3.14 dicttest.py\n Time (mean ± σ): 20.084 s ± 0.230 s [User: 19.503 s, System: 0.577 s]\n Range (min … max): 19.749 s … 20.345 s 10 runs\n \nSummary\n cp313/python/bin/python3.13 dicttest.py ran\n 5.81 ± 0.10 times faster than cp314/python/bin/python3.14 dicttest.py\n```\n\n\u003cimg width=\"1920\" height=\"1054\" alt=\"Time comparison plot of Python 3.13 vs Python 3.14\" src=\"https://github.com/user-attachments/assets/b06f1b4c-3ac5-4ec2-9a0a-0f6fe226c67a\" /\u003e\n\nPlotting time (in seconds) of the script run with `n = 0 ... 2000`.\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-140204\n* gh-140262\n* gh-140304\n* gh-140362\n* gh-140363\n* gh-140423\n* gh-140447\n* gh-140575\n* gh-140701\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/pgdr","@type":"Person","name":"pgdr"},"datePublished":"2025-10-11T10:11:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":31},"url":"https://github.com/139951/cpython/issues/139951"}
| 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:1ab8bdfb-4f41-62ea-261c-32a5c1548652 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA04:144C84:BAB0B6:105C3C5:696A29D5 |
| html-safe-nonce | ac5253904ad6d59376baf6e3a2e7a5eebe1e634095d3d5bc8a98e0d7ae1ad913 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTA0OjE0NEM4NDpCQUIwQjY6MTA1QzNDNTo2OTZBMjlENSIsInZpc2l0b3JfaWQiOiI3ODY0MzYwMDkzMTQwNzg5NzE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 049fb0dbbce685e7c1df4e6d96a829361f20d41a2b36aff94ffa2a723a7c1a6c |
| hovercard-subject-tag | issue:3505571273 |
| 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/139951/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8903d2334b8713a266b61865a1dbffa564de609622375c3f1459874a81eedf06/python/cpython/issues/139951 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8903d2334b8713a266b61865a1dbffa564de609622375c3f1459874a81eedf06/python/cpython/issues/139951 |
| og:image:alt | Bug report Bug description: The following code, consisting of a bunch of dict lookups and writes, runs in < 1 second on Python 3.13 > 2 seconds on Python 3.14 n = 1000 d = {} for i in range(n): d[(... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pgdr |
| hostname | github.com |
| expected-hostname | github.com |
| None | a1022f03e4f0d91ea173e4e5dac892c982e0588c62f1ce56121d755a320a3569 |
| 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 | f472b8e6c7b3fdd5d0354972a3f4c516289bf0be |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width