René's URL Explorer Experiment


Title: gh-153568: Reduce parser allocations by pablogsal · Pull Request #157374 · python/cpython · GitHub

Open Graph Title: gh-153568: Reduce parser allocations by pablogsal · Pull Request #157374 · python/cpython

X Title: gh-153568: Reduce parser allocations by pablogsal · Pull Request #157374 · python/cpython

Description: Allocate tokens in blocks and keep text only for names, literals and type comments. Use a bit for the Barry spelling and put the keyword error messages in the grammar. Create the identifier cache on first use and reuse the newline buffer. Reuse parsed names and numbers during backtracking, and reset memo filters before the error pass. Related to #153568. Issue: gh-153568 Codebase Python files Parsing speed Peak parser memory Standard library 2,060 8.0% faster 11.1% less Home Assistant 18,731 4.4% faster 6.7% less mypy 442 5.9% faster 10.7% less PyTorch 4,890 7.2% faster 5.1% less

Open Graph Description: Allocate tokens in blocks and keep text only for names, literals and type comments. Use a bit for the Barry spelling and put the keyword error messages in the grammar. Create the identifier cache o...

X Description: Allocate tokens in blocks and keep text only for names, literals and type comments. Use a bit for the Barry spelling and put the keyword error messages in the grammar. Create the identifier cache o...

Opengraph URL: https://github.com/python/cpython/pull/157374

X: @github

direct link

Domain: github.com

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:7347c7ed-fae2-489d-7a05-65778ef1434c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEE14:EAD6D:306301:3CFB0E:6B0208BC
html-safe-noncef4011c6e41df8176875e2d0711f6380e1b10f390125e544f150480681cc1267f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTE0OkVBRDZEOjMwNjMwMTozQ0ZCMEU6NkIwMjA4QkMiLCJ2aXNpdG9yX2lkIjoiMzYxNDUxMTc5Nzk3OTE4NzM4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacaf250f1100e00899f5c6425269f65a174614b633c093d239e7d0fbe6e905cfbc
hovercard-subject-tagpull_request:4514926918
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/157374/files
twitter:imagehttps://avatars.githubusercontent.com/u/11718525?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/11718525?s=400&v=4
og:image:altAllocate tokens in blocks and keep text only for names, literals and type comments. Use a bit for the Barry spelling and put the keyword error messages in the grammar. Create the identifier cache o...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/157374/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F157374%2Ffiles
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%2Fpull%2F157374%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/157374/files
Reloadhttps://github.com/python/cpython/pull/157374/files
Reloadhttps://github.com/python/cpython/pull/157374/files
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
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
pablogsalhttps://github.com/pablogsal
python:mainhttps://github.com/python/cpython/tree/main
pablogsal:gh-153568-parser-allocationshttps://github.com/pablogsal/cpython/tree/gh-153568-parser-allocations
Conversation 1 https://github.com/python/cpython/pull/157374
Commits 10 https://github.com/python/cpython/pull/157374/commits
Checks 52 https://github.com/python/cpython/pull/157374/checks
Files changed 8 https://github.com/python/cpython/pull/157374/files
gh-153568: Reduce parser allocations https://github.com/python/cpython/pull/157374/files#top
Show all changes 10 commits https://github.com/python/cpython/pull/157374/files
e8f8854 gh-153568: Allocate parser tokens in blocks pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/e8f8854f709cee06e87179da212fece8c06958d2
a66ca87 gh-153568: Avoid copying fixed parser token text pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/a66ca873323045dcf7fb0cafee9df17d079049a9
d5cc533 gh-153568: Allocate the parser identifier cache on first use pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/d5cc5336d56c13fea954cdb2609e13bf1c0320e4
472faa2 gh-153568: Reuse the tokenizer newline buffer pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/472faa21a97245c6f9d0db3c3828ed01a499635a
7c9f1cd gh-153568: Clear memo filters before the parser error pass pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/7c9f1cd90f757a191f544b56bc0385831f7f1704
c669a32 gh-153568: Reuse parsed name nodes during backtracking pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/c669a32c3c0bb361d2aeac99ba81a41b4e6e5b05
e2e3e7d gh-153568: Reuse parsed numbers during backtracking pablogsal Sep 12, 2026 https://github.com/python/cpython/pull/157374/commits/e2e3e7d4b8d4d5c220d9b0cdb555313a969e8f1c
5252627 gh-153568: Explain parser allocation and buffer invariants pablogsal Sep 14, 2026 https://github.com/python/cpython/pull/157374/commits/5252627b02969918dbbaf984d75c7c8f2d9f30e8
ac85f97 gh-153568: Simplify parser identifier and buffer handling pablogsal Sep 14, 2026 https://github.com/python/cpython/pull/157374/commits/ac85f97240e57f290f3fac2d3a9c551985df32e7
dd5b683 gh-153568: Keep NOTEQUAL spelling in token text pablogsal Sep 14, 2026 https://github.com/python/cpython/pull/157374/commits/dd5b683221dd429506b4dc925499a16ac05112b7
Clear filters https://github.com/python/cpython/pull/157374/files
Please reload this pagehttps://github.com/python/cpython/pull/157374/files
Please reload this pagehttps://github.com/python/cpython/pull/157374/files
python.gram https://github.com/python/cpython/pull/157374/files#diff-2973ca53337859793077e9bdc1a1623063379f0fdfcb788836fd82ebb66b763b
2026-09-12-12-00-00.gh-issue-153568.parser.rst https://github.com/python/cpython/pull/157374/files#diff-8271ff7aa35aa596c0304253caacb4493fbca11ed2b7cadca5ee8cbc17aa499a
parser.c https://github.com/python/cpython/pull/157374/files#diff-6d39440cedc67d1ce7a0586bfb6ecb8483803448a9c93f3fae3ad0e2260e29f7
pegen.c https://github.com/python/cpython/pull/157374/files#diff-ec9a9d08c5b1d518997db0f5b4795c528a41efc35507d6c2a384eee43f047cb7
pegen.h https://github.com/python/cpython/pull/157374/files#diff-5803bf7cd8fdced0a7448e74074f36018f2206ab77ad13dc7451b1948b950852
decoder.c https://github.com/python/cpython/pull/157374/files#diff-20b697a19ba8581bf383b48255bb0cc3bc160c264aeaeeea96be6e2daf471741
reader.c https://github.com/python/cpython/pull/157374/files#diff-ee1ccf9c461ad2982f27a89c79c7ea2e5868fef86dbd8d8d1d873e1624208590
reader_internal.h https://github.com/python/cpython/pull/157374/files#diff-b0bf3853f60d9c70ce122af7b63f26d886e22d2bf72e06c5a04402dc26b5a494
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L308
Grammar/python.gramhttps://github.com/python/cpython/pull/157374/files#diff-2973ca53337859793077e9bdc1a1623063379f0fdfcb788836fd82ebb66b763b
View file https://github.com/pablogsal/cpython/blob/dd5b683221dd429506b4dc925499a16ac05112b7/Grammar/python.gram
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/157374/{{ revealButtonHref }}
https://github.com/python/cpython/pull/157374/files#diff-2973ca53337859793077e9bdc1a1623063379f0fdfcb788836fd82ebb66b763b
https://github.com/python/cpython/pull/157374/files#diff-2973ca53337859793077e9bdc1a1623063379f0fdfcb788836fd82ebb66b763b
Misc/NEWS.d/next/Core_and_Builtins/2026-09-12-12-00-00.gh-issue-153568.parser.rsthttps://github.com/python/cpython/pull/157374/files#diff-8271ff7aa35aa596c0304253caacb4493fbca11ed2b7cadca5ee8cbc17aa499a
View file https://github.com/pablogsal/cpython/blob/dd5b683221dd429506b4dc925499a16ac05112b7/Misc/NEWS.d/next/Core_and_Builtins/2026-09-12-12-00-00.gh-issue-153568.parser.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/157374/{{ revealButtonHref }}
Please reload this pagehttps://github.com/python/cpython/pull/157374/files
Please reload this pagehttps://github.com/python/cpython/pull/157374/files
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.