René's URL Explorer Experiment


Title: gh-118761: Optimise import time for ast by AA-Turner · Pull Request #131953 · python/cpython · GitHub

Open Graph Title: gh-118761: Optimise import time for ast by AA-Turner · Pull Request #131953 · python/cpython

X Title: gh-118761: Optimise import time for ast by AA-Turner · Pull Request #131953 · python/cpython

Description: Attempting @JelleZijlstra's suggestion in #118761 (comment). Running python -Ximporttime -Sc "import ast" ten times with the current and proposed modules, I get 14.1ms for the current module and 1.48ms for the new, for a ~12ms speed up. I've left numbers out of the NEWS entry for now, as I've only tested on a Windows PC -- Linux may have different performance profiles. Full Times (using the last line of each output) Current import time: self [us] | cumulative | imported package import time: 1277 | 13904 | ast import time: 1363 | 14813 | ast import time: 1343 | 14246 | ast import time: 1330 | 14280 | ast import time: 1387 | 13974 | ast import time: 1373 | 13837 | ast import time: 1345 | 14456 | ast import time: 1349 | 14050 | ast import time: 1322 | 14226 | ast import time: 1246 | 13444 | ast Proposed import time: 455 | 1338 | ast import time: 457 | 1387 | ast import time: 476 | 1470 | ast import time: 459 | 1474 | ast import time: 493 | 1480 | ast import time: 499 | 1458 | ast import time: 448 | 1513 | ast import time: 492 | 1501 | ast import time: 487 | 1515 | ast import time: 602 | 1688 | ast Issue: gh-118761

Open Graph Description: Attempting @JelleZijlstra's suggestion in #118761 (comment). Running python -Ximporttime -Sc "import ast" ten times with the current and proposed modules, I get 14.1ms for the curren...

X Description: Attempting @JelleZijlstra's suggestion in #118761 (comment). Running python -Ximporttime -Sc "import ast" ten times with the current and proposed modules, I get 14.1ms fo...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/commits/:range(.:format)
route-controllerpull_requests
route-actioncommits
fetch-noncev2:f060579f-a96e-6db0-fea7-ce62f7da9281
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id930A:22FFB1:DF5B39:12A4EFF:6994F988
html-safe-nonce44e98560ce6c125d79a9f517fccf5d7b20f60a79d49c16ec46b7403498ac5fef
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzBBOjIyRkZCMTpERjVCMzk6MTJBNEVGRjo2OTk0Rjk4OCIsInZpc2l0b3JfaWQiOiIxNDI0NjQ0MTY3MTM3ODE5MDE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac86cb9f3ed312d0f338fe7e701d3ee7a44b4462359a093c706fb3fb3c2fa6c62b
hovercard-subject-tagpull_request:2429625247
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/commits
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
twitter:imagehttps://avatars.githubusercontent.com/u/9087854?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/9087854?s=400&v=4
og:image:altAttempting @JelleZijlstra's suggestion in #118761 (comment). Running python -Ximporttime -Sc "import ast" ten times with the current and proposed modules, I get 14.1ms for the curren...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4bd759bc5f83244e2a0de29b937365905c0fefd238b6f077c24a49830375b4df
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-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2616d2b216d6e9d52f595f6aaf832bb7a377b236
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F131953%2Fcommits%2Fdc95d19556bf741572286c9402265a4e6949219d
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F131953%2Fcommits%2Fdc95d19556bf741572286c9402265a4e6949219d
Sign up https://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%2Fcommits&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
Reloadhttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
Reloadhttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.5k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
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
AA-Turnerhttps://github.com/AA-Turner
python:mainhttps://github.com/python/cpython/tree/main
AA-Turner:opt-asthttps://github.com/AA-Turner/cpython/tree/opt-ast
Conversation 14 https://github.com/python/cpython/pull/131953
Commits 5 https://github.com/python/cpython/pull/131953/commits
Checks 46 https://github.com/python/cpython/pull/131953/checks
Files changed https://github.com/python/cpython/pull/131953/files
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
gh-118761: Optimise import time for ast https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#top
Show all changes 5 commits https://github.com/python/cpython/pull/131953/files
1629db7 Optimise import time for ast AA-Turner Mar 31, 2025 https://github.com/python/cpython/pull/131953/commits/1629db74705dc9ea1f941d50f0b9384d155e1fcf
dc95d19 fixup! Optimise import time for ast AA-Turner Mar 31, 2025 https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
460491e Add private unparse names to getattr AA-Turner Apr 1, 2025 https://github.com/python/cpython/pull/131953/commits/460491e5d14510ad9fc59a8bbce5a1aa8a15e2b2
d88eb24 Define module level __dir__ AA-Turner Apr 1, 2025 https://github.com/python/cpython/pull/131953/commits/d88eb24b2e5c1e81ed393f604590304dfcc47002
a546328 Revert "Add private unparse names to getattr" AA-Turner Apr 1, 2025 https://github.com/python/cpython/pull/131953/commits/a5463286921a91a25ea7c9f9d72aa8fcde57f4e2
Clear filters https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
CODEOWNERS https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-3d36a1bf06148bc6ba1ce2ed3d19de32ea708d955fed212c0d27c536f0bd4da7
test_ast.py https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
stdlib_module_names.h https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-152e0a1d932d06bae2302482de6c49082b62169699729700d445d4f588504af5
Prev https://github.com/python/cpython/pull/131953/commits/1629db74705dc9ea1f941d50f0b9384d155e1fcf
Next https://github.com/python/cpython/pull/131953/commits/460491e5d14510ad9fc59a8bbce5a1aa8a15e2b2
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
https://github.com/AA-Turner
AA-Turnerhttps://github.com/python/cpython/commits?author=AA-Turner
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L66
.github/CODEOWNERShttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-3d36a1bf06148bc6ba1ce2ed3d19de32ea708d955fed212c0d27c536f0bd4da7
View file https://github.com/AA-Turner/cpython/blob/dc95d19556bf741572286c9402265a4e6949219d/.github/CODEOWNERS
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/131953/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-3d36a1bf06148bc6ba1ce2ed3d19de32ea708d955fed212c0d27c536f0bd4da7
https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-3d36a1bf06148bc6ba1ce2ed3d19de32ea708d955fed212c0d27c536f0bd4da7
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L203
Lib/test/test_ast/test_ast.pyhttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
View file https://github.com/AA-Turner/cpython/blob/dc95d19556bf741572286c9402265a4e6949219d/Lib/test/test_ast/test_ast.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/131953/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
Python/stdlib_module_names.hhttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d#diff-152e0a1d932d06bae2302482de6c49082b62169699729700d445d4f588504af5
View file https://github.com/AA-Turner/cpython/blob/dc95d19556bf741572286c9402265a4e6949219d/Python/stdlib_module_names.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
Please reload this pagehttps://github.com/python/cpython/pull/131953/commits/dc95d19556bf741572286c9402265a4e6949219d
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.