[issue22127] performance regression in socket getsockaddrarg()

Charles-François Natali report at bugs.python.org
Mon Aug 4 09:50:33 CEST 2014


Charles-François Natali added the comment:

> Note that even the bytes version is still quite slow. UDP is used for light-weight protocols where you may send thousands or more messages per second. I'd be curious what the sendto() performance is in raw C.

Ah, I wouldn't rely on the absolyte values, my computer is *slow*.

On a more recent machine, I get this:
100000 loops, best of 3: 8.82 usec per loop

Whereas a C loop gives a 4usec per loop.

> "Abc" is a bytes string in Python 2 and an Unicode string in Python 3.

Sure, but why do getaddrinfo() and gethostbyname() return strings then?

This means that someone using:

addr = getaddrinfo(...)
sendto(DATA, addr)

Will pay the idna encoding upon every call to sendto().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22127>
_______________________________________


More information about the Python-bugs-list mailing list