Title: speed up urllib.request.getproxies_environment · Issue #91539 · python/cpython · GitHub
Open Graph Title: speed up urllib.request.getproxies_environment · Issue #91539 · python/cpython
X Title: speed up urllib.request.getproxies_environment · Issue #91539 · python/cpython
Description: in module urllib.request, function getproxies_environment (https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L2493) iterate over all environment variables twice I made a test: create 2500 environment variables call and ti...
Open Graph Description: in module urllib.request, function getproxies_environment (https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L2493) iterate over all environment variables twice I made a test: creat...
X Description: in module urllib.request, function getproxies_environment (https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L2493) iterate over all environment variables twice I made a test: creat...
Opengraph URL: https://github.com/python/cpython/issues/91539
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"speed up urllib.request.getproxies_environment","articleBody":"\r\nin module urllib.request, function getproxies_environment (https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L2493)\r\n\r\niterate over all environment variables twice\r\n\r\nI made a test:\r\n1. create 2500 environment variables\r\n2. call and timing getproxies_environment()\r\n3. the result is: getproxies_environment() take more than 50ms, which is a big overhead \r\n\r\nso if there are many environment variables(like 10 thousands) in a machine, packages depend on function urllib.request.getproxies_environment (like requests does) shall be very slow\r\n\r\nis 10 thousands environment variables reasonable?\r\n\r\nyes it is, for example, in k8s cluster,kubelete may add a set of environment variables all Services(could be 10 thousands even 100 thousands), in purpose of service discovery \r\n\r\nso would it be ok that getproxies_environment don't iterate over all environment variables? \r\n\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-108771\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/bohea","@type":"Person","name":"bohea"},"datePublished":"2022-04-14T15:30:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/91539/cpython/issues/91539"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d217baf2-333e-e62d-a6f1-e68d1156134b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9758:2F4DD4:75D94A:9F2C88:69697949 |
| html-safe-nonce | 89557fa46f91319f643fc872a8ba1d50372c47a03f15ede45a485bc41d5b5ca9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzU4OjJGNERENDo3NUQ5NEE6OUYyQzg4OjY5Njk3OTQ5IiwidmlzaXRvcl9pZCI6IjMxMzkzNzMwOTA4NDc5NDcwODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 36cda1688a44fd6cf93fe7e0fa23d74a9dc71c117b149bfde4b28c6e67e9377d |
| hovercard-subject-tag | issue:1204679352 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/91539/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2af188b6a3d15b7e66d2eac4588f9f2ef97e09ac443de7f43f0fe46cb6cf11cc/python/cpython/issues/91539 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2af188b6a3d15b7e66d2eac4588f9f2ef97e09ac443de7f43f0fe46cb6cf11cc/python/cpython/issues/91539 |
| og:image:alt | in module urllib.request, function getproxies_environment (https://github.com/python/cpython/blob/main/Lib/urllib/request.py#L2493) iterate over all environment variables twice I made a test: creat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bohea |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6f193beb8ff08443adc07685d75302ab8aaf0a135f6e251c3ff3112c8deb881 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 212e3e3d3298bf5b313830edfd2399e869f7ea76 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width