• Victor Stinner's avatar
    asyncio: Only call _check_resolved_address() in debug mode · 2fc23130
    Victor Stinner yazdı
    * _check_resolved_address() is implemented with getaddrinfo() which is slow
    * If available, use socket.inet_pton() instead of socket.getaddrinfo(), because
      it is much faster
    
    Microbenchmark (timeit) on Fedora 21 (Python 3.4, Linux 3.17, glibc 2.20) to
    validate the IPV4 address "127.0.0.1" or the IPv6 address "::1":
    
    * getaddrinfo() 10.4 usec per loop
    * inet_pton(): 0.285 usec per loop
    
    On glibc older than 2.14, getaddrinfo() always requests the list of all local
    IP addresses to the kernel (using a NETLINK socket). getaddrinfo() has other
    known issues, it's better to avoid it when it is possible.
    2fc23130
proactor_events.py 19.7 KB