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-118761: Optimise import time forshlex#132036

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

Merged
AA-Turner merged 6 commits intopython:mainfromAA-Turner:opt-shlex
Apr 24, 2025

Conversation

AA-Turner
Copy link
Member

@AA-TurnerAA-Turner commentedApr 2, 2025
edited
Loading

This PR achieves a 33x improvement in import time for theshlex module and a 4-12x improvement in performance forshlex.quote.

Current:

import shlex: cumulative timemean: 9065.967 µsmedian: 9092.000 µsstdev: 282.015min: 8587max: 9556

This PR:

import shlex: cumulative timemean: 274.300 µsmedian: 275.000 µsstdev: 8.860min: 259max: 289

sergey-miryanov reacted with rocket emoji
@JelleZijlstra
Copy link
Member

I'm not sure this is practically useful, since pretty much anything you'd do within the module will trigger the imports. Also, importingsys andio is practically free since they're imported at startup.

@AA-Turner
Copy link
MemberAuthor

AA-Turner commentedApr 4, 2025
edited
Loading

True, this one is more marginal.quote andjoin will only importre, whereassplit andshlex will importcollections/os.path. Whereshlex is used in the stdlib, it's often only one of these two groups, so I think it could still have benefits?

Edit:quote andjoin now no longer importre

A

@python-cla-bot

This comment was marked as resolved.

@AA-TurnerAA-Turner requested a review frompicnixzApril 20, 2025 21:50
@AA-TurnerAA-Turner merged commit06a26fd intopython:mainApr 24, 2025
39 checks passed
@AA-TurnerAA-Turner deleted the opt-shlex branchApril 24, 2025 15:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rruuaanngrruuaanngrruuaanng approved these changes

@picnixzpicnixzAwaiting requested review from picnixz

@JelleZijlstraJelleZijlstraAwaiting requested review from JelleZijlstra

Assignees
No one assigned
Labels
performancePerformance or resource usage
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@AA-Turner@JelleZijlstra@picnixz@rruuaanng

[8]ページ先頭

©2009-2025 Movatter.jp