René's URL Explorer Experiment


Title: gh-162507: Speed up floating and complex `array` by maurycy · Pull Request #162509 · python/cpython · GitHub

Open Graph Title: gh-162507: Speed up floating and complex `array` by maurycy · Pull Request #162509 · python/cpython

X Title: gh-162507: Speed up floating and complex `array` by maurycy · Pull Request #162509 · python/cpython

Description: Call PyFloat_AsDouble() directly in the e, f and d setters and PyComplex_AsCComplex() in the Zf and Zd setters, so we skip a PyArg_Parse() call for each item during array construction and assignment. macOS PGO+LTO: Operation Baseline Patched Baseline / patched array('e', floats) 7.36 ± 0.70 µs 3.63 ± 0.04 µs 2.03x array('f', floats) 7.36 ± 0.10 µs 3.87 ± 0.11 µs 1.90x array('d', ints) 7.24 ± 0.21 µs 4.42 ± 0.20 µs 1.64x array('d', floats) 6.13 ± 0.05 µs 3.32 ± 0.01 µs 1.84x array('Zf', complexes) 9.18 ± 0.17 µs 6.30 ± 0.03 µs 1.46x array('Zd', complexes) 6.94 ± 0.11 µs 4.11 ± 0.10 µs 1.69x array('i', ints) (control) 6.71 ± 0.08 µs 6.72 ± 0.18 µs 1.00x a[0] = value 15.41 ± 0.42 ns 11.60 ± 0.23 ns 1.33x scimark_fft 114.72 ± 2.18 ms 103.74 ± 0.40 ms 1.11x bench from array import array import pyperf ints = list(range(1, 1001)) floats = list(map(float, ints)) complexes = [complex(x, -x) for x in ints] a = array("d", [0]) value = 3.5 runner = pyperf.Runner() for stmt in ( "array('e', floats)", "array('f', floats)", "array('d', ints)", "array('d', floats)", "array('Zf', complexes)", "array('Zd', complexes)", "array('i', ints)", "a[0] = value", ): runner.timeit(stmt, stmt, globals=globals()) ref #162478 Closes #162507 Issue: gh-162507

Open Graph Description: Call PyFloat_AsDouble() directly in the e, f and d setters and PyComplex_AsCComplex() in the Zf and Zd setters, so we skip a PyArg_Parse() call for each item during array construction and assignmen...

X Description: Call PyFloat_AsDouble() directly in the e, f and d setters and PyComplex_AsCComplex() in the Zf and Zd setters, so we skip a PyArg_Parse() call for each item during array construction and assignmen...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4

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:2febfb1a-b2fa-9a69-6947-bfe50150fc2a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBD9C:36611F:108C044:15E2A59:6B06502E
html-safe-nonce1ef641e87a74e8d2d60f61e61c5763d8eb92234be6c28b65150e6c9fdeab5dce
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDlDOjM2NjExRjoxMDhDMDQ0OjE1RTJBNTk6NkIwNjUwMkUiLCJ2aXNpdG9yX2lkIjoiNjA1MDA1ODY4Nzc3MzgyMzAyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1f84e1ce49481f126508e87ba1cd40c972953c91720e713405e8b731c48a4ebc
hovercard-subject-tagpull_request:5462101720
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/162509/files
twitter:imagehttps://avatars.githubusercontent.com/u/5383?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/5383?s=400&v=4
og:image:altCall PyFloat_AsDouble() directly in the e, f and d setters and PyComplex_AsCComplex() in the Zf and Zd setters, so we skip a PyArg_Parse() call for each item during array construction and assignmen...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e
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
releasef1f9a08f7c769a37f1dfc18ad43d463c222a7eea
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/162509/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F162509%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%2F162509%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/162509/files
Reloadhttps://github.com/python/cpython/pull/162509/files
Reloadhttps://github.com/python/cpython/pull/162509/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
maurycyhttps://github.com/maurycy
python:mainhttps://github.com/python/cpython/tree/main
maurycy:array-direct-conversionhttps://github.com/maurycy/cpython/tree/array-direct-conversion
Conversation 5 https://github.com/python/cpython/pull/162509
Commits 3 https://github.com/python/cpython/pull/162509/commits
Checks 59 https://github.com/python/cpython/pull/162509/checks
Files changed 3 https://github.com/python/cpython/pull/162509/files
gh-162507: Speed up floating and complex array https://github.com/python/cpython/pull/162509/files#top
Show all changes 3 commits https://github.com/python/cpython/pull/162509/files
44ce953 avoid parsing queen maurycy Nov 23, 2026 https://github.com/python/cpython/pull/162509/commits/44ce953f3c349dcfa33aebdd27f23b158863a6ee
bf53f63 test maurycy Nov 23, 2026 https://github.com/python/cpython/pull/162509/commits/bf53f63223261ce22aa237a7a8f1080e0d7c31dc
51d281d news maurycy Nov 23, 2026 https://github.com/python/cpython/pull/162509/commits/51d281daaacc48c12fb3e1666e4afc65fb8ee1a2
Clear filters https://github.com/python/cpython/pull/162509/files
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
test_array.py https://github.com/python/cpython/pull/162509/files#diff-9171e2213953c56e609d6fae2f15892982341fd9f076fe69c4a73c3e52d7dfb9
2026-11-23-23-11-49.gh-issue-162507.hG5bdI.rst https://github.com/python/cpython/pull/162509/files#diff-9f4f0b89428f17d7f9d572786bf1da75935ee21c15ab382bfa2b2fa6aa163f82
arraymodule.c https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
Lib/test/test_array.pyhttps://github.com/python/cpython/pull/162509/files#diff-9171e2213953c56e609d6fae2f15892982341fd9f076fe69c4a73c3e52d7dfb9
View file https://github.com/python/cpython/blob/51d281daaacc48c12fb3e1666e4afc65fb8ee1a2/Lib/test/test_array.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/162509/{{ revealButtonHref }}
https://github.com/python/cpython/pull/162509/files#diff-9171e2213953c56e609d6fae2f15892982341fd9f076fe69c4a73c3e52d7dfb9
https://github.com/python/cpython/pull/162509/files#diff-9171e2213953c56e609d6fae2f15892982341fd9f076fe69c4a73c3e52d7dfb9
Misc/NEWS.d/next/Library/2026-11-23-23-11-49.gh-issue-162507.hG5bdI.rsthttps://github.com/python/cpython/pull/162509/files#diff-9f4f0b89428f17d7f9d572786bf1da75935ee21c15ab382bfa2b2fa6aa163f82
View file https://github.com/python/cpython/blob/51d281daaacc48c12fb3e1666e4afc65fb8ee1a2/Misc/NEWS.d/next/Library/2026-11-23-23-11-49.gh-issue-162507.hG5bdI.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/162509/{{ revealButtonHref }}
Modules/arraymodule.chttps://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
View file https://github.com/python/cpython/blob/51d281daaacc48c12fb3e1666e4afc65fb8ee1a2/Modules/arraymodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/162509/{{ revealButtonHref }}
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
skirpichevhttps://github.com/skirpichev
Nov 23, 2026https://github.com/python/cpython/pull/162509/files#r4673382907
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
eendebakpthttps://github.com/eendebakpt
Nov 23, 2026https://github.com/python/cpython/pull/162509/files#r4673210076
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
skirpichevhttps://github.com/skirpichev
Nov 23, 2026https://github.com/python/cpython/pull/162509/files#r4673377259
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/162509/files
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
https://github.com/python/cpython/pull/162509/files#diff-a64ccdf7f6d9fe7fbe417fe2d24c7803c152b75640bdc5a6539754aa71bc6a51
Please reload this pagehttps://github.com/python/cpython/pull/162509/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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.