Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-117865: Defer several imports in inspect.py#119526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
AlexWaygood wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromAlexWaygood:speedup-inspect-import

Conversation

AlexWaygood
Copy link
Member

@AlexWaygoodAlexWaygood commentedMay 24, 2024
edited by bedevere-appbot
Loading

Following153b3f7, it is suddenly much more trivial to make the import of ast lazy in inspect.py. Once that's done, it also becomes worthwhile to make other imports lazy as well

@AlexWaygood
Copy link
MemberAuthor

I'm about to board a flight, but I think this cuts nearly 50% off the import time forinspect

@AlexWaygood
Copy link
MemberAuthor

(But this is possibly a redundant optimisation if it turns out thatinspect needs to depend onast more heavily due to PEP 649 anyway? Not sure)

@AlexWaygood
Copy link
MemberAuthor

I'll keep this on the back burner until it's decided where the newPEP-649 functions will go, and which modules they'll depend on

@AlexWaygoodAlexWaygood added DO-NOT-MERGE performancePerformance or resource usage labelsMay 29, 2024
Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(This showed up in my list of review requests, so I want to clear it out even if it's a draft.)

I think we can apply the changes that don't affectast. My current implementation of the PEP 649 functionality relies very heavily onast, so it's likely we won't be able to defer that import.

@AlexWaygood
Copy link
MemberAuthor

I think we can apply the changes that don't affectast.

Right -- butast itself imports a bunch of stuff, so I'm not sure how much deferring the other imports helps if we can't defer theast import. It might just make the code uglier for no apparent gain. I'll play around a bit when I get a chance; maybe now we've deferred there import inast things might have changed...

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JelleZijlstraJelleZijlstraJelleZijlstra left review comments

@jaracojaracoAwaiting requested review from jaraco

Assignees
No one assigned
Labels
DO-NOT-MERGEperformancePerformance or resource usage
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@AlexWaygood@JelleZijlstra

[8]ページ先頭

©2009-2025 Movatter.jp