René's URL Explorer Experiment


Title: Computed-goto interpreter 9–13% slower when built with Clang 19 or Xcode 16.3–16.4: dispatch jumps are merged · Issue #158283 · python/cpython · GitHub

Open Graph Title: Computed-goto interpreter 9–13% slower when built with Clang 19 or Xcode 16.3–16.4: dispatch jumps are merged · Issue #158283 · python/cpython

X Title: Computed-goto interpreter 9–13% slower when built with Clang 19 or Xcode 16.3–16.4: dispatch jumps are merged · Issue #158283 · python/cpython

Description: When CPython is built with Clang 19, or with Apple clang from Xcode 16.3 or 16.4, the computed-goto interpreter ends up with a single shared indirect jump instead of one dispatch jump per opcode. Per-opcode branch prediction is the point...

Open Graph Description: When CPython is built with Clang 19, or with Apple clang from Xcode 16.3 or 16.4, the computed-goto interpreter ends up with a single shared indirect jump instead of one dispatch jump per opcode. P...

X Description: When CPython is built with Clang 19, or with Apple clang from Xcode 16.3 or 16.4, the computed-goto interpreter ends up with a single shared indirect jump instead of one dispatch jump per opcode. P...

Opengraph URL: https://github.com/python/cpython/issues/158283

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Computed-goto interpreter 9–13% slower when built with Clang 19 or Xcode 16.3–16.4: dispatch jumps are merged","articleBody":"When CPython is built with Clang 19, or with Apple clang from Xcode 16.3 or 16.4, the computed-goto interpreter ends up with a single shared indirect jump instead of one dispatch jump per opcode. Per-opcode branch prediction is the point of computed gotos; restoring it makes pyperformance 8–9% faster on Linux and 11% faster on macOS arm64 with Xcode 16.4. Put the other way round, current builds with these compilers are 9–13% slower.\n\nLLVM 19 limited tail duplication of blocks that end in an indirect branch (llvm/llvm-project#78582). Clang lowers all computed gotos to one shared `indirectbr` block and relies on tail duplication to copy it back into each predecessor; the new limit stops that. LLVM 20.1.0 fixed this partially (llvm/llvm-project#116072) and 20.1.1 fully (llvm/llvm-project#114990). No 19.x release has the fix. Xcode 26.0–26.3 has the partial fix; it still merges most dispatch jumps, but the cost is only 1.4%.\n\nGCC builds and the tail-calling interpreter (`--with-tail-call-interp`) are not affected.\n\nNelson Elhage [found in March 2025](https://blog.nelhage.com/post/cpython-tail-call/) that this LLVM 19 regression accounted for most of the originally reported speedup of the 3.14 tail-calling interpreter. His issue about merged dispatch jumps, gh-129987, was closed after gh-132295 and gh-132530, which changed GCC's SLP vectorization; Clang 19 builds still have one dispatch jump.\n\n### Measurements\n\nIndirect jumps in `_PyEval_EvalFrameDefault`, in `Python/ceval.o` built at `-O3` (x86-64) and in the final PGO+LTO binary. PGO builds are not deterministic, so the PGO+LTO counts are ranges over the independent builds:\n\n| compiler | `-O3` object | PGO+LTO binary |\n|---|---|---|\n| GCC 12 / 13 / 14 | 257 | 234 |\n| Clang 18 | 269 | not measured |\n| Clang 19.1.7 | 1 | 1–9 |\n| Clang 19.1.7 + `-mllvm -tail-dup-pred-size=1000` | 269 | 356–360 |\n| Clang 21 | 268 | 354–362 |\n\npyperformance on x86-64 Linux GitHub runners, main at 6af40a6. Each experiment used a randomized block design with the builds interleaved per benchmark and a same-binary control; the 95% confidence interval is a bootstrap over independent builds. Negative is faster.\n\n| comparison | build | builds | geomean | 95% CI |\n|---|---|---|---|---|\n| Clang 19 + `-mllvm -tail-dup-pred-size=1000` vs Clang 19 | PGO+LTO | 6 | −8.6% | [−9.6, −7.4] |\n| Clang 19 vs GCC 13 | PGO+LTO | 6 | +7.7% | [+6.4, +8.7] |\n| Clang 19 + flag vs GCC 13 | PGO+LTO | 6 | −1.6% | [−1.8, −1.3] |\n| gh-158286 vs main, Clang 19 | PGO+LTO | 6 | −8.4% | [−9.5, −6.9] |\n| gh-158286 vs main, Clang 19 | thin LTO, no PGO (FreeBSD's configuration) | 8 | −8.7% | [−9.2, −8.3] |\n\nThe same-binary controls were within ±0.2%. The biggest single-benchmark gains are 18–24% (unpack_sequence, deepcopy_memo, nbody, scimark_sor); regex_effbot gets 6–9% slower. Under LTO the option also un-merges the regex engine's own computed-goto dispatch, and the regex_effbot slowdown depends strongly on code layout: with three randomised layouts per build it is 1–9% on the EPYC 7763 runners, and the three regex benchmarks together show no significant change ([data](https://github.com/matthiasgoergens/cpython/tree/clang19-dispatch-data/experiments/exp13-sre-layout); details in gh-158286).\n\nmacOS 15 arm64 GitHub runners, PGO+LTO, gh-158286 vs main:\n\n| compiler | dispatch jumps before → after | builds | geomean | 95% CI |\n|---|---|---|---|---|\n| Xcode 16.4 (Apple clang 1700.0.13) | 1 → 356–357 | 5 | −11.4% | [−13.2, −9.8] |\n| Xcode 26.3 (Apple clang 1700.6) | 110–121 → 356–358 | 5 | −1.4% | [−2.2, −0.7] |\n\nThese runners are noisier; the same-binary control there was −0.4% [−1.8, +0.9].\n\nRaw data, configurations and scripts: https://github.com/matthiasgoergens/cpython/tree/clang19-dispatch-data\n\n### Affected builds\n\nChecked against the compiler string in shipped binaries where possible:\n\n- FreeBSD 14 and 15 packages, python311 to python314 (base clang 19.1.7, thin LTO)\n- OpenBSD 7.8 and 7.9, python 3.12 and 3.13 (base clang 19.1.7)\n- OpenMandriva Lx 6.0, python 3.11 (clang 19.1.7)\n- macOS builds made with Xcode 16.3 or 16.4, for example MacPorts python313 and python314 on macOS 15: one dispatch jump left\n- macOS builds made with Xcode 26.0–26.3, for example Homebrew's macOS 15 bottles: 94 of ~300 (arm64) or 62 of ~276 (x86-64) dispatch jumps left in a `--with-lto` build\n\npython-build-standalone/uv (January–February 2025) and conda-forge's macOS builds also used Clang 19 for a while, but have since moved on. Xcode 26.4 and later still merge some dispatch jumps (200 in `ceval.o`, 328 with the option added by hand); gh-158286 leaves them alone.\n\n### Proposed fix\n\ngh-158286 passes `-mllvm -tail-dup-pred-size=1000` when compiling `ceval.c` with Clang 19 or Apple clang 1700.x (Xcode 16.3–26.3), and to the linker with LTO.\n\n### CPython versions tested on:\nCPython main branch\n\n### Operating systems tested on:\nLinux, macOS\n\n\n","author":{"url":"https://github.com/matthiasgoergens","@type":"Person","name":"matthiasgoergens"},"datePublished":"2026-09-27T14:23:01Z","url":"https://github.com/python/cpython/issues/158283"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c5325ed7-8955-7852-55aa-2c46dea95d49
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAA48:2A98A:C0BD0F:F26B5A:6B023A97
html-safe-nonced8ea7614ab8c5368f416d7cfabd4d25a782d8882189754547dd5738da63635fb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTQ4OjJBOThBOkMwQkQwRjpGMjZCNUE6NkIwMjNBOTciLCJ2aXNpdG9yX2lkIjoiMjc5NDkwMjYxMzM1NzkwMjQ4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac84e0442ae4420ea2cee36dc11cf5c4d9eb8920dc6126486aac868f3d21e1dab4
hovercard-subject-tagissue:5603403176
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/158283/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aa3165f457f7971cac54aff3e2c85fc5d94760708ef1c493796687fa09dbfc42/python/cpython/issues/158283
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aa3165f457f7971cac54aff3e2c85fc5d94760708ef1c493796687fa09dbfc42/python/cpython/issues/158283
og:image:altWhen CPython is built with Clang 19, or with Apple clang from Xcode 16.3 or 16.4, the computed-goto interpreter ends up with a single shared indirect jump instead of one dispatch jump per opcode. P...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamematthiasgoergens
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/158283#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F158283
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F158283
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/158283
Reloadhttps://github.com/python/cpython/issues/158283
Reloadhttps://github.com/python/cpython/issues/158283
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/158283
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/158283
Computed-goto interpreter 9–13% slower when built with Clang 19 or Xcode 16.3–16.4: dispatch jumps are mergedhttps://github.com/python/cpython/issues/158283#top
buildThe build process and cross-buildhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22build%22
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/matthiasgoergens
matthiasgoergenshttps://github.com/matthiasgoergens
on Sep 27, 2026https://github.com/python/cpython/issues/158283#issue-5603403176
llvm/llvm-project#78582https://github.com/llvm/llvm-project/pull/78582
llvm/llvm-project#116072https://github.com/llvm/llvm-project/pull/116072
llvm/llvm-project#114990https://github.com/llvm/llvm-project/pull/114990
found in March 2025https://blog.nelhage.com/post/cpython-tail-call/
gh-129987https://github.com/python/cpython/issues/129987
gh-132295https://github.com/python/cpython/pull/132295
gh-132530https://github.com/python/cpython/pull/132530
6af40a6https://github.com/python/cpython/commit/6af40a682881f8442e1bdae67d34b186ef42826a
gh-158286https://github.com/python/cpython/pull/158286
gh-158286https://github.com/python/cpython/pull/158286
datahttps://github.com/matthiasgoergens/cpython/tree/clang19-dispatch-data/experiments/exp13-sre-layout
gh-158286https://github.com/python/cpython/pull/158286
gh-158286https://github.com/python/cpython/pull/158286
https://github.com/matthiasgoergens/cpython/tree/clang19-dispatch-datahttps://github.com/matthiasgoergens/cpython/tree/clang19-dispatch-data
gh-158286https://github.com/python/cpython/pull/158286
gh-158286https://github.com/python/cpython/pull/158286
picnixzhttps://github.com/picnixz
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
buildThe build process and cross-buildhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22build%22
on Sep 27, 2026https://github.com/python/cpython/issues/158283#event-31934256609
matthiasgoergenshttps://github.com/matthiasgoergens
on Sep 27, 2026https://github.com/python/cpython/issues/158283#event-31934483969
pythongh-158283: Force dispatch tail duplication with Clang 19 and Ap…https://github.com/matthiasgoergens/cpython/commit/384d72bfe75aebebe756fcdf921b4105e35f2d45
pythongh-158283https://github.com/python/cpython/issues/158283
384d72bhttps://github.com/matthiasgoergens/cpython/commit/384d72bfe75aebebe756fcdf921b4105e35f2d45
perf-notes: issue filed as python#158283; PR body links data branch […https://github.com/matthiasgoergens/cpython/commit/6a313b40c6a28c809b6d415c652de46a20a82ed5
python#158283https://github.com/python/cpython/issues/158283
6a313b4https://github.com/matthiasgoergens/cpython/commit/6a313b40c6a28c809b6d415c652de46a20a82ed5
perf-notes: issue python#158283 and PR python#158286 filed [skip ci]https://github.com/matthiasgoergens/cpython/commit/ef47c18c54016d6a98e72820091aeb91da9216e5
python#158283https://github.com/python/cpython/issues/158283
python#158286https://github.com/python/cpython/pull/158286
ef47c18https://github.com/matthiasgoergens/cpython/commit/ef47c18c54016d6a98e72820091aeb91da9216e5
pythongh-158283: Force dispatch tail duplication with Clang 19 and Ap…https://github.com/matthiasgoergens/cpython/commit/65772c6be36aee53f623f63c6e7df51bcf86defe
pythongh-158283https://github.com/python/cpython/issues/158283
65772c6https://github.com/matthiasgoergens/cpython/commit/65772c6be36aee53f623f63c6e7df51bcf86defe
Measurements and scripts for python#158283https://github.com/matthiasgoergens/cpython/commit/4de591f3a3b7ed3bd83974643dba9ec1a8e997f9
python#158283https://github.com/python/cpython/issues/158283
4de591fhttps://github.com/matthiasgoergens/cpython/commit/4de591f3a3b7ed3bd83974643dba9ec1a8e997f9
perf-notes: issue filed as python#158283; PR body links data branch […https://github.com/matthiasgoergens/cpython/commit/92a07ffdb12518255cd8ca83e0aae6bf94fce25a
python#158283https://github.com/python/cpython/issues/158283
92a07ffhttps://github.com/matthiasgoergens/cpython/commit/92a07ffdb12518255cd8ca83e0aae6bf94fce25a
perf-notes: issue python#158283 and PR python#158286 filed [skip ci]https://github.com/matthiasgoergens/cpython/commit/fc218d6a9ef778b423f9978959a2b1852b1e220f
python#158283https://github.com/python/cpython/issues/158283
python#158286https://github.com/python/cpython/pull/158286
fc218d6https://github.com/matthiasgoergens/cpython/commit/fc218d6a9ef778b423f9978959a2b1852b1e220f
matthiasgoergenshttps://github.com/matthiasgoergens
on Sep 27, 2026https://github.com/python/cpython/issues/158283#event-31951688280
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/158283#event-33592134785
github-project-automationhttps://github.com/apps/github-project-automation
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/158283
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/158283#event-33592172878
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/158283
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/158283
buildThe build process and cross-buildhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22build%22
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.