Title: Python3.13 performance Issue with python.org macOS installers on ARM Macs · Issue #122580 · python/cpython · GitHub
Open Graph Title: Python3.13 performance Issue with python.org macOS installers on ARM Macs · Issue #122580 · python/cpython
X Title: Python3.13 performance Issue with python.org macOS installers on ARM Macs · Issue #122580 · python/cpython
Description: The Python programming language. Contribute to python/cpython development by creating an account on GitHub.
Open Graph Description: The Python programming language. Contribute to python/cpython development by creating an account on GitHub.
X Description: The Python programming language. Contribute to python/cpython development by creating an account on GitHub.
Opengraph URL: https://github.com/python/cpython
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python3.13 performance Issue with python.org macOS installers on ARM Macs","articleBody":"### Bug description:\r\nPython3.13rc1 seems to be about 20-25% slower than Python3.12.4.\r\nPlatform: M1 Mac running MacOS Sonoma 14.5 \r\n\r\nI first noticed the issue when running [this repository](https://github.com/Aardvark-team/Aardvark) where Python3.13rc1 ran on average 20-25% slower than Python3.12.4\r\n\r\nWith help from the Python discord server, we were able to create this minimal reproducible example:\r\n```python\r\nfrom time import process_time\r\n\r\nclass Lexer:\r\n def __init__(self, data):\r\n self.data = data\r\n self.index = 0\r\n\r\n def detect(self, text):\r\n i = 0\r\n for char in text:\r\n if self.peek(i) != char:\r\n return False\r\n i += 1\r\n return True\r\n\r\n def peek(self, amt=1):\r\n if self.index + amt \u003c len(self.data):\r\n return self.data[self.index + amt]\r\n else:\r\n return None\r\n\r\ntext = \"return text + indent * ' ' + '}'\\n\" * 200\r\nneedle = \"return text + indent * ' ' + '}'\\n\" * 199 + \"Nope\\n\" \r\nlexer = Lexer(text)\r\nstart = process_time() \r\nfor x in range(10_000):\r\n lexer.detect(needle)\r\nprint(process_time() - start)\r\n```\r\nThese were the results across many tests:\r\n**3.12.4:** 7.742122s\r\n**3.13rc1:** 8.309326s\r\n\r\nThe performance issue was not reproducible on other Operating Systems.\r\n\r\n\r\n### CPython versions tested on:\r\n\r\n3.11.1, 3.12.4, 3.13\r\n\r\n\r\n## CPython Options:\r\nFor my testing, I used the official Python3.13rc1 installer from Python.org, which has the following configuration:\r\n### OPT:\r\n**3.13rc1:** `-DNDEBUG -g -O3 -Wall`\r\n**3.12.4:** `-DNDEBUG -g -O3 -Wall`\r\n\r\n### CONFIG_ARGS:\r\n**3.13rc1:** `'--enable-framework' '--with-framework-name=Python' '--enable-universalsdk=/' '--with-universal-archs=universal2' '--enable-optimizations' '--with-lto' '--without-ensurepip' '--with-system-libmpdec' '--with-openssl=/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local' 'LIBLZMA_CFLAGS=-I/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/include' 'LIBLZMA_LIBS=-L/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/lib -llzma' 'LIBMPDEC_CFLAGS=-I/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/include' 'LIBMPDEC_LIBS=-L/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/lib -lmpdec -lm' 'LIBSQLITE3_CFLAGS=-I/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/include' 'LIBSQLITE3_LIBS=-L/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/lib -lsqlite3' 'TCLTK_CFLAGS=-I/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/include' 'TCLTK_LIBS=-L/Users/nad/release-tools/macos-installer/installer/variant/binaries/build/libraries/usr/local/lib -ltcl -ltk' 'CC=clang'`\r\n**3.12.4:** `'-C' '--enable-framework' '--enable-universalsdk=/' '--with-universal-archs=universal2' '--with-computed-gotos' '--without-ensurepip' '--with-openssl=/tmp/_py/libraries/usr/local' '--enable-optimizations' '--with-lto' 'TCLTK_CFLAGS=-I/tmp/_py/libraries/usr/local/include' 'TCLTK_LIBS=-ltcl8.6 -ltk8.6' 'LDFLAGS=-g' 'CFLAGS=-g' 'CC=clang'`\r\n\r\n\r\n### Operating systems tested on:\r\n\r\nLinux, macOS, Windows","author":{"url":"https://github.com/hg0428","@type":"Person","name":"hg0428"},"datePublished":"2024-08-01T19:52:34Z","url":"https://github.com/python/cpython/issues/122580"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:c1e17dfe-eb75-5838-78cb-2f56d6abf42d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7E0:A99C2:4103C9B:5281B37:6B020985 |
| html-safe-nonce | c7fb81aa89028ea00f95e499b3efea6ec971fad9e5e5f0febd5d36e66d0c8c76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0UwOkE5OUMyOjQxMDNDOUI6NTI4MUIzNzo2QjAyMDk4NSIsInZpc2l0b3JfaWQiOiI2MTg3NjA0Nzc0OTA5Nzc0MjE0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ebfffdd5de086025d3433dfcbf37473757d16208eda5edb18355671be81d67cd |
| hovercard-subject-tag | repository:81598961 |
| 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/python/cpython/issues/122580 |
| twitter:image | https://opengraph.githubassets.com/266781776e7761c26feebf324de08621356d542594238e87edceca77a82e26e0/python/cpython |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/266781776e7761c26feebf324de08621356d542594238e87edceca77a82e26e0/python/cpython |
| og:image:alt | The Python programming language. Contribute to python/cpython development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-cache |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width