René's URL Explorer Experiment


Title: Faster decode and find_max_char implementations. · Issue #120196 · python/cpython · GitHub

Open Graph Title: Faster decode and find_max_char implementations. · Issue #120196 · python/cpython

X Title: Faster decode and find_max_char implementations. · Issue #120196 · python/cpython

Description: Feature or enhancement Proposal: I have spotted a few inefficiencies in the stringlib implementations that hinder the compilers ability to optimize the code. These could be fixed. find_max_char, the 1-byte version. This unrolls checking ...

Open Graph Description: Feature or enhancement Proposal: I have spotted a few inefficiencies in the stringlib implementations that hinder the compilers ability to optimize the code. These could be fixed. find_max_char, th...

X Description: Feature or enhancement Proposal: I have spotted a few inefficiencies in the stringlib implementations that hinder the compilers ability to optimize the code. These could be fixed. find_max_char, th...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Faster decode and find_max_char implementations.","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nI have spotted a few inefficiencies in the stringlib implementations that hinder the compilers ability to optimize the code. These could be fixed. \n\n- find_max_char, the 1-byte version. This unrolls checking 4 or 8-byte chunks. Alignment (which does not matter for x86-64 but may be important on other platforms) happens by checking one character at the time. This can be sped up by simply bitwise OR-ing all the characters together, and only check all the alginments with one check. Furthermore, the loop can be unrolled using 32-byte chunks. (4 size_t integers). By doing so, the compiler needs only very few extra instructions to do the bitwise or and can use 16-byte vectors. These are available on both x86-64 and ARM64 and the compiler will optimize easily. The less than 32 byte remainder can then be obtained by simply bitwise OR-ing these characters together and perform the check. \n- Find_max_char, the 2-byte and 4-byte version. These now work with unrolls of 4. For the 2-byte version this means an 8-byte load. Increasing the unroll to  8, this means 16-byte and 32-byte loads. The compiler can vectorize this. \n- Stringlib codecs.h utf8_decode on line 47 states, fast unrolled copy. These statements can be replaced by `memcpy(*_p, *_s, SIZEOF_SIZE_T); Using `*restrict` the compiler should understand that a read does not need to be performed twice, and memcpy using a fixed size is always optimized out. \n- ascii_decode: same as find_max_char. This can be optimized using larger chunks.\n\n\n\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-120212\n* gh-120497\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/rhpvorderman","@type":"Person","name":"rhpvorderman"},"datePublished":"2024-06-07T07:44:03Z","url":"https://github.com/python/cpython/issues/120196"}

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:cb6e6c2d-56b1-c4c9-8002-95719f42153a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB8E6:1773CF:2CF3A8:3B5C94:6B02335B
html-safe-nonceece2b13a0967f7efcad5d5410e552cd79f21f675709be986254a06497d6f5a4b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEU2OjE3NzNDRjoyQ0YzQTg6M0I1Qzk0OjZCMDIzMzVCIiwidmlzaXRvcl9pZCI6IjQ0NDMyOTI4MTY1NDE2MjcyMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1956758ae9776e7f15d656d17d7eea00a798fa315ff60f7d4f59f822590bf633
hovercard-subject-tagissue:2339809802
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/120196/issue_layout
twitter:imagehttps://opengraph.githubassets.com/449c2a9a450137b72e4a73d8922d7ef31969484d22e83c9ac634a098ebd9f5c8/python/cpython/issues/120196
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/449c2a9a450137b72e4a73d8922d7ef31969484d22e83c9ac634a098ebd9f5c8/python/cpython/issues/120196
og:image:altFeature or enhancement Proposal: I have spotted a few inefficiencies in the stringlib implementations that hinder the compilers ability to optimize the code. These could be fixed. find_max_char, th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerhpvorderman
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-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/120196#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F120196
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%2F120196
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/120196
Reloadhttps://github.com/python/cpython/issues/120196
Reloadhttps://github.com/python/cpython/issues/120196
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/120196
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/120196
Faster decode and find_max_char implementations.https://github.com/python/cpython/issues/120196#top
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/rhpvorderman
rhpvordermanhttps://github.com/rhpvorderman
on Jun 7, 2024https://github.com/python/cpython/issues/120196#issue-2339809802
gh-120196: Faster ascii_decode and find_max_char implementations #120212https://github.com/python/cpython/pull/120212
gh-120196: Reuse find_max_char for bytes objects #120497https://github.com/python/cpython/pull/120497
rhpvordermanhttps://github.com/rhpvorderman
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
on Jun 7, 2024https://github.com/python/cpython/issues/120196#event-13076524938
Eclips4https://github.com/Eclips4
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
on Jun 7, 2024https://github.com/python/cpython/issues/120196#event-13076535856
https://github.com/erlend-aasland
erlend-aaslandhttps://github.com/erlend-aasland
on Jun 7, 2024https://github.com/python/cpython/issues/120196#issuecomment-2154504752
https://github.com/rhpvorderman
rhpvordermanhttps://github.com/rhpvorderman
on Jun 7, 2024https://github.com/python/cpython/issues/120196#issuecomment-2154519068
https://discuss.python.org/t/building-python-takes-longer-than-an-hour-due-to-freezing-objects-and-still-counting/55144/1https://discuss.python.org/t/building-python-takes-longer-than-an-hour-due-to-freezing-objects-and-still-counting/55144/1
https://github.com/rhpvorderman
rhpvordermanhttps://github.com/rhpvorderman
on Jun 7, 2024https://github.com/python/cpython/issues/120196#issuecomment-2154550589
vstinnerhttps://github.com/vstinner
on Jun 17, 2024https://github.com/python/cpython/issues/120196#event-13183461983
gh-120196: Reuse find_max_char() for bytes objects (#120497)https://github.com/python/cpython/commit/945a89b48f017d711055da039899eaecc2eb7ddd
gh-120196https://github.com/python/cpython/issues/120196
#120497https://github.com/python/cpython/pull/120497
945a89bhttps://github.com/python/cpython/commit/945a89b48f017d711055da039899eaecc2eb7ddd
mrahtzhttps://github.com/mrahtz
on Jun 30, 2024https://github.com/python/cpython/issues/120196#event-13341935538
pythongh-120196: Reuse find_max_char() for bytes objects (python#120497)https://github.com/mrahtz/cpython/commit/b93d655557aa3c9a752006417ccd247b02b20f3d
pythongh-120196https://github.com/python/cpython/issues/120196
python#120497https://github.com/python/cpython/pull/120497
b93d655https://github.com/mrahtz/cpython/commit/b93d655557aa3c9a752006417ccd247b02b20f3d
estyxxhttps://github.com/estyxx
on Jul 17, 2024https://github.com/python/cpython/issues/120196#event-13533262058
pythongh-120196: Reuse find_max_char() for bytes objects (python#120497)https://github.com/estyxx/cpython/commit/9d3b8463c4bdee3cbc29ab8f5ed1fba608c3416e
pythongh-120196https://github.com/python/cpython/issues/120196
python#120497https://github.com/python/cpython/pull/120497
9d3b846https://github.com/estyxx/cpython/commit/9d3b8463c4bdee3cbc29ab8f5ed1fba608c3416e
https://github.com/rhpvorderman
rhpvordermanhttps://github.com/rhpvorderman
on Sep 16, 2024https://github.com/python/cpython/issues/120196#issuecomment-2352089256
rhpvordermanhttps://github.com/rhpvorderman
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 16, 2024https://github.com/python/cpython/issues/120196#event-14267145743
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/120196
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/120196
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%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.