Title: bpo-32221: makeipaddr: remove interface part + speedup by socketpair · Pull Request #4724 · python/cpython · GitHub
Open Graph Title: bpo-32221: makeipaddr: remove interface part + speedup by socketpair · Pull Request #4724 · python/cpython
X Title: bpo-32221: makeipaddr: remove interface part + speedup by socketpair · Pull Request #4724 · python/cpython
Description: https://bugs.python.org/issue32221 recvfrom from multicast socket is painfull slow. In fact, it returns sender address in form: ('fe80::941f:f6ff:fe04:c560%qwe', 42133, 0, 78) which is superfluous, since interface-name part (%qwe) is not actually used. Actually, scopeid (78) signify interface/scope/zone_id. This tuple can be used for .sendto() either with this interface-name-part or without. The problem is in the performance. For each socket.recvrfom(), libc.getnameinfo() internally converts interface index to interface name using three syscalls, i.e. socket(), getsockopt()?, close() , which slows down receiving (I have not measured result, but see additional syscalls in strace). In order to convert from tuple to string-based full address one may use socket.getnameinfo(): As you can see, initial interface is ignored (but without my patch it is also validated uselessly): In[1]: socket.getnameinfo(('fe80::941f:f6ff:fe04:c560%qwe', 42133, 0, 78), socket.NI_NUMERICHOST) Out[1]: ('fe80::941f:f6ff:fe04:c560%qwe', '42133') In[2]: socket.getnameinfo(('fe80::941f:f6ff:fe04:c560', 42133, 0, 78), socket.NI_NUMERICHOST) Out[2]: ('fe80::941f:f6ff:fe04:c560%qwe', '42133')
Open Graph Description: https://bugs.python.org/issue32221 recvfrom from multicast socket is painfull slow. In fact, it returns sender address in form: ('fe80::941f:f6ff:fe04:c560%qwe', 42133, 0, 78) which is sup...
X Description: https://bugs.python.org/issue32221 recvfrom from multicast socket is painfull slow. In fact, it returns sender address in form: ('fe80::941f:f6ff:fe04:c560%qwe', 42133, 0, 78) whic...
Opengraph URL: https://github.com/python/cpython/pull/4724
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:51f9bcf3-562b-c835-feb1-cb0dc4001f09 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 97CC:33F819:2D5AAD0:3DE157F:6A53D312 |
| html-safe-nonce | b6e7da1eb675c4299d73acc0175fda35be6f8f2c3ae146e98b622d2f62a82190 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0NDOjMzRjgxOToyRDVBQUQwOjNERTE1N0Y6NkE1M0QzMTIiLCJ2aXNpdG9yX2lkIjoiODMxNzgzMDM2ODEyOTcwMDYyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 21c30b8d1bab17d2c3679f3f574d1fa7880cb20e599113cb839cef595a03d273 |
| hovercard-subject-tag | pull_request:156375510 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/4724/files |
| twitter:image | https://avatars.githubusercontent.com/u/1157412?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1157412?s=400&v=4 |
| og:image:alt | https://bugs.python.org/issue32221 recvfrom from multicast socket is painfull slow. In fact, it returns sender address in form: ('fe80::941f:f6ff:fe04:c560%qwe', 42133, 0, 78) which is sup... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width