This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients ezio.melotti, maker, neologix, pitrou, santoso.wijaya, vstinner
Date 2013-09-03.18:54:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378234457.06.0.824803120844.issue16201@psf.upfronthosting.co.za>
In-reply-to
Content
Here's an updated patch with new tests.

It passes the regression test, and yields noticable performance improvements for IPv6:
before:
$ ./python -m timeit -s "import socket; s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); DATA = b'hello'" "s.sendto(DATA, ('127.0.0.1', 4242)) "
10000 loops, best of 3: 28 usec per loop
$ ./python -m timeit -s "import socket; s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM); DATA = b'hello'" "s.sendto(DATA, ('::1', 4242)) "
10000 loops, best of 3: 59.1 usec per loop
after:
$ ./python -m timeit -s "import socket; s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); DATA = b'hello'" "s.sendto(DATA, ('127.0.0.1', 4242)) "
10000 loops, best of 3: 24.8 usec per loop
$ ./python -m timeit -s "import socket; s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM); DATA = b'hello'" "s.sendto(DATA, ('::1', 4242)) "
10000 loops, best of 3: 26.7 usec per loop

Note that the tests aren't as good as I'd like them to, because apparently some systems (e.g. Solaris) have broken gethostbyaddr()...
But it's cleaner, more robust and more efficient.
History
Date User Action Args
2013-09-03 18:54:17neologixsetrecipients: + neologix, pitrou, vstinner, ezio.melotti, santoso.wijaya, maker
2013-09-03 18:54:17neologixsetmessageid: <1378234457.06.0.824803120844.issue16201@psf.upfronthosting.co.za>
2013-09-03 18:54:17neologixlinkissue16201 messages
2013-09-03 18:54:16neologixcreate