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

Optimize load_verify_locations to Improve Import Performance #97

Closed
wants to merge 1 commit into from

Conversation

dosine-staging[bot]
Copy link

@dosine-staging dosine-staging bot commented Sep 2, 2024

This pull request addresses the performance regression introduced between versions 2.31.0 and 2.32.3, where import time increased by approximately 25%. The root cause was identified as the load_verify_locations() function being executed at import time due to changes in psf#6667.

To resolve this, the load_verify_locations function call has been deferred to runtime, ensuring it does not impact the import performance. The changes are confined to src/requests/adapters.py and include adjustments to the import statements and the proxy_manager_for method to conditionally import SOCKSProxyManager only when necessary.

This optimization should restore the import performance to its previous state without affecting the functionality.

@SamStenner SamStenner closed this Sep 2, 2024
@SamStenner SamStenner deleted the cosine/fix/import-time-issue branch September 2, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant