Title: pickletools optimize performance degraded with factor 3-4 in python 3.14 · Issue #140175 · python/cpython · GitHub
Open Graph Title: pickletools optimize performance degraded with factor 3-4 in python 3.14 · Issue #140175 · python/cpython
X Title: pickletools optimize performance degraded with factor 3-4 in python 3.14 · Issue #140175 · python/cpython
Description: Bug report Bug description: The pickletools.optimize code suddenly performs bad starting with python 3.14, with or without JIT. The degradation is a factor 3 to 4. It is easy to test. First use this script to make a sizeable dict and pic...
Open Graph Description: Bug report Bug description: The pickletools.optimize code suddenly performs bad starting with python 3.14, with or without JIT. The degradation is a factor 3 to 4. It is easy to test. First use thi...
X Description: Bug report Bug description: The pickletools.optimize code suddenly performs bad starting with python 3.14, with or without JIT. The degradation is a factor 3 to 4. It is easy to test. First use thi...
Opengraph URL: https://github.com/python/cpython/issues/140175
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pickletools optimize performance degraded with factor 3-4 in python 3.14","articleBody":"# Bug report\n\n### Bug description:\n\nThe pickletools.optimize code suddenly performs bad starting with python 3.14, with or without JIT.\nThe degradation is a factor 3 to 4.\n\nIt is easy to test.\n\nFirst use this script to make a sizeable dict and pickle it and write it to file.\n\n```python\n\nimport pickle\n\nx = {}\n\nfor i in range(1, 1000000):\n x[i] = f\"ii{i:\u003e07}\"\n\nwith open(\"pickled\", \"wb\") as fh:\n pickle.dump(x, fh, protocol=4)\n```\n\nThen write a script, let's call it `optpickle.py` to read the pickled dict from file and optimize it and write the result to another file.\n\n```python\n# optpickle.py\n\nimport pickletools\n\nwith open(\"pickled\", \"rb\") as fh:\n p = fh.read()\n\ns = pickletools.optimize(p)\n\nwith open(\"pickledopt\", \"wb\") as fh:\n fh.write(s)\n```\n\nNow execute this in three separate terminal windows, one geared to python 3.13, one to python 3.14.0 without JIT, and one to python 3.14.0 with JIT.\n\nMy results on a mac with M1 processor were\n\nversion | time elapsed | cpu time\n--- | --- | ---\n3.13 | 1.67| 1.773\n3.14.0 no JIT | 6.52 | 6.664\n3.14.0 JIT | 6.52 | 6.642\n\nThat is a dramatic drop in performance!\n\nThe filesizes are 16.9 MB for the unoptimized file and 15.9 for the optimized one.\n\nI decided to drop the optimization in an [app where I used it heavily](https://github.com/annotation/text-fabric/blob/7de3664b7ddd0ec0dc4c1c6d5da9bf04b9848b73/tf/core/data.py#L687-L688)\n\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nmacOS","author":{"url":"https://github.com/dirkroorda","@type":"Person","name":"dirkroorda"},"datePublished":"2025-10-15T18:23:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/140175/cpython/issues/140175"}
| 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:cbfa4d57-eafa-30ba-b1f1-23c552623d05 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A046:217FCE:5E5F6F:808FBE:6969D6B4 |
| html-safe-nonce | a6820815dc06fdf00111c6ab76a0334f46a97505b4f779265f2bf03874811f6a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDQ2OjIxN0ZDRTo1RTVGNkY6ODA4RkJFOjY5NjlENkI0IiwidmlzaXRvcl9pZCI6IjQxMzAxNjA5MTQ1MDI2NzMxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4585136b68289ce8b69e3e6e6126ecb25fca66f4b0537a737c0a4d81a95815ea |
| hovercard-subject-tag | issue:3519108991 |
| 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/140175/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f9904b555361e73234f38b24d14373bfaf2ed070421367da164635f6db327c3/python/cpython/issues/140175 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f9904b555361e73234f38b24d14373bfaf2ed070421367da164635f6db327c3/python/cpython/issues/140175 |
| og:image:alt | Bug report Bug description: The pickletools.optimize code suddenly performs bad starting with python 3.14, with or without JIT. The degradation is a factor 3 to 4. It is easy to test. First use thi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dirkroorda |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width