René's URL Explorer Experiment


Title: gh-150942: Speed up re.findall and re.sub/subn result building by eendebakpt · Pull Request #150943 · python/cpython · GitHub

Open Graph Title: gh-150942: Speed up re.findall and re.sub/subn result building by eendebakpt · Pull Request #150943 · python/cpython

X Title: gh-150942: Speed up re.findall and re.sub/subn result building by eendebakpt · Pull Request #150943 · python/cpython

Description: Append result items to the output list with _PyList_AppendTakeRef instead of PyList_Append followed by Py_DECREF, removing a reference-count round-trip per appended item (and a per-append lock on the free-threaded build). Microbenchmarks Benchmark main this PR speedup re_sub 1.93 ms 1.73 ms 1.11× re_subn 1.92 ms 1.73 ms 1.11× re_findall 1.89 ms 1.80 ms 1.05× re_findall_groups 4.01 ms 3.87 ms 1.04× geomean 1.06× Benchmark script """Microbenchmark re.findall / split / sub / subn (result-list building).""" import re import pyperf WORDS = "the quick brown fox jumps over the lazy dog " * 2000 CSVISH = "field1,field2,field3,field4,field5,field6,field7,field8\n" * 3000 word_re = re.compile(r"\w+") group_re = re.compile(r"(\w)(\w+)") split_re = re.compile(r"[,\n]") sub_re = re.compile(r"\w+") def b_findall(): return word_re.findall(WORDS) def b_findall_groups(): return group_re.findall(WORDS) # list of tuples def b_sub(): return sub_re.sub("X", WORDS) def b_subn(): return sub_re.subn("X", WORDS) if __name__ == "__main__": runner = pyperf.Runner() runner.bench_func("re_findall", b_findall) runner.bench_func("re_findall_groups", b_findall_groups) runner.bench_func("re_sub", b_sub) runner.bench_func("re_subn", b_subn) Issue: gh-150942

Open Graph Description: Append result items to the output list with _PyList_AppendTakeRef instead of PyList_Append followed by Py_DECREF, removing a reference-count round-trip per appended item (and a per-append lock on t...

X Description: Append result items to the output list with _PyList_AppendTakeRef instead of PyList_Append followed by Py_DECREF, removing a reference-count round-trip per appended item (and a per-append lock on t...

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

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:b6bbbe02-305f-8a16-f421-9ea497254ab3
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA60E:36A3E:370C6BF:4965C62:6B021650
html-safe-nonce2f626d4c6c551ba884b36b5c5d4ceb3a190f5faf1080e9382e079843d053ead3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjBFOjM2QTNFOjM3MEM2QkY6NDk2NUM2Mjo2QjAyMTY1MCIsInZpc2l0b3JfaWQiOiIyOTEwOTgzNzQyNDM4OTA1NDI0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace586eababf39efd2f58bb946caf725fa2aed81de652eb65f1b7a30afd6128b70
hovercard-subject-tagpull_request:3808359272
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/150943/files
twitter:imagehttps://avatars.githubusercontent.com/u/883786?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/883786?s=400&v=4
og:image:altAppend result items to the output list with _PyList_AppendTakeRef instead of PyList_Append followed by Py_DECREF, removing a reference-count round-trip per appended item (and a per-append lock on t...
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/150943/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F150943%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%2F150943%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/150943/files
Reloadhttps://github.com/python/cpython/pull/150943/files
Reloadhttps://github.com/python/cpython/pull/150943/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
corona10https://github.com/corona10
python:mainhttps://github.com/python/cpython/tree/main
eendebakpt:re-takeref-opthttps://github.com/eendebakpt/cpython/tree/re-takeref-opt
Conversation 2 https://github.com/python/cpython/pull/150943
Commits 2 https://github.com/python/cpython/pull/150943/commits
Checks 62 https://github.com/python/cpython/pull/150943/checks
Files changed https://github.com/python/cpython/pull/150943/files
Please reload this pagehttps://github.com/python/cpython/pull/150943/files
gh-150942: Speed up re.findall and re.sub/subn result building https://github.com/python/cpython/pull/150943/files#top
Show all changes 2 commits https://github.com/python/cpython/pull/150943/files
191730a gh-XXXXX: Speed up re.findall and re.sub/subn result building eendebakpt May 31, 2026 https://github.com/python/cpython/pull/150943/commits/191730a7c6b330edc0a157c9d35acac146c9c7dc
bf25fc5 gh-150942: Set issue number on the re speedup news entry eendebakpt Jun 5, 2026 https://github.com/python/cpython/pull/150943/commits/bf25fc59b3501f09a768747aef7e848cb326f7f7
Clear filters https://github.com/python/cpython/pull/150943/files
Please reload this pagehttps://github.com/python/cpython/pull/150943/files
Please reload this pagehttps://github.com/python/cpython/pull/150943/files
2026-05-31-12-00-00.gh-issue-150942.Re7Ref.rst https://github.com/python/cpython/pull/150943/files#diff-6af341015d0aa8b291c39f769d7aa8203b5562eeb2b7c9450236b038c92b997c
sre.c https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
Misc/NEWS.d/next/Library/2026-05-31-12-00-00.gh-issue-150942.Re7Ref.rsthttps://github.com/python/cpython/pull/150943/files#diff-6af341015d0aa8b291c39f769d7aa8203b5562eeb2b7c9450236b038c92b997c
View file https://github.com/eendebakpt/cpython/blob/bf25fc59b3501f09a768747aef7e848cb326f7f7/Misc/NEWS.d/next/Library/2026-05-31-12-00-00.gh-issue-150942.Re7Ref.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/150943/{{ revealButtonHref }}
Modules/_sre/sre.chttps://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
View file https://github.com/eendebakpt/cpython/blob/bf25fc59b3501f09a768747aef7e848cb326f7f7/Modules/_sre/sre.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/150943/{{ revealButtonHref }}
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
https://github.com/python/cpython/pull/150943/files#diff-b715247383fe7eb29c4592bf02da337a5ed85dfcbb4862bf3f5d4f2537dce22d
Please reload this pagehttps://github.com/python/cpython/pull/150943/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.