Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up socket.errorTab and lazy import selectors #121423

Closed
Wulian233 opened this issue Jul 6, 2024 · 1 comment
Closed

Speed up socket.errorTab and lazy import selectors #121423

Wulian233 opened this issue Jul 6, 2024 · 1 comment
Labels
performance Performance or resource usage type-feature A feature request or enhancement

Comments

@Wulian233
Copy link
Contributor

Wulian233 commented Jul 6, 2024

Feature or enhancement

socket

>python -m timeit -n 1000 -s "import socket" "print(socket.__all__)"
1000 loops, best of 5: 407 usec per loop

>python -m timeit -n 1000 -s "import socket" "print(socket.__all__)"
1000 loops, best of 5: 352 usec per loop

1.15x faster

Linked PRs

@Wulian233 Wulian233 added the type-feature A feature request or enhancement label Jul 6, 2024
@Wulian233 Wulian233 changed the title Speed up socket.errotTab and lazy import selectors Speed up socket.errorTab and lazy import selectors Jul 6, 2024
@sobolevn sobolevn added the performance Performance or resource usage label Jul 6, 2024
vstinner pushed a commit that referenced this issue Sep 4, 2024
Improve import time of `socket` by writing `socket.errorTab`
as a constant and lazy import modules.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
@vstinner
Copy link
Member

vstinner commented Sep 4, 2024

Implemented by 7bd964d.

@vstinner vstinner closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants