gh-91539: Small performance improvement of urrlib.request.getproxies_environment()#108771
Merged
hauntsaninja merged 7 commits intoJan 15, 2024
Merged
Conversation
…are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
eendebakpt
reviewed
Sep 17, 2023
Contributor
|
Small benchmark: results in So there is indeed a small performance improvement. |
eendebakpt
approved these changes
Sep 17, 2023
…NLEI.rst Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Contributor
@hauntsaninja is there anything we still need to do for this pr? |
kulikjak
pushed a commit
to kulikjak/cpython
that referenced
this pull request
Jan 22, 2024
…oxies_environment() (python#108771) Small performance improvement of getproxies_environment() when there are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
…oxies_environment() (python#108771) Small performance improvement of getproxies_environment() when there are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
…oxies_environment() (python#108771) Small performance improvement of getproxies_environment() when there are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a small (10 - 20%) and trivial performance improvement of urrlib.request.getproxies_environment() , typically useful when there are many environment variables to go over.
This function is typically called each time one does a request using the requests package, and can become a bottleneck when there are 1000s of (unrelated) environment variables, so any performance improvement in this function is welcome.
This is an additional performance improvement to what was already done as part of #91539.
Performance details
With 100 unrelated env vars:
python getproxies_environment_benchmark.py 100
And with 5000:
With the code below: