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 smejkar
Recipients benjamin.peterson, serhiy.storchaka, smejkar
Date 2017-06-21.10:08:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1498039721.21.0.654334327188.issue30710@psf.upfronthosting.co.za>
In-reply-to
Content
> But how large is the performance hit of this change? It adds at least one additional memory allocation for the str object. If the slowdown is significant perhaps it is worth to keep the old code as a fast path.

commit 5cc7ac24da10568d2a910a91a24183b904118cf8
./python -m timeit -s 'import socket' 'socket.getaddrinfo(None, 1000)'
2000 loops, best of 5: 139 usec per loop
./python -m timeit -s 'import socket' 'socket.getaddrinfo(None, "1000")'
2000 loops, best of 5: 142 usec per loop

with getaddrinfo_overflow_error.patch
./python -m timeit -s 'import socket' 'socket.getaddrinfo(None, 1000)'
2000 loops, best of 5: 140 usec per loop
./python -m timeit -s 'import socket' 'socket.getaddrinfo(None, "1000")'
2000 loops, best of 5: 139 usec per loop

It seems the impact on performance is negligible/not measurable.
History
Date User Action Args
2017-06-21 10:08:41smejkarsetrecipients: + smejkar, benjamin.peterson, serhiy.storchaka
2017-06-21 10:08:41smejkarsetmessageid: <1498039721.21.0.654334327188.issue30710@psf.upfronthosting.co.za>
2017-06-21 10:08:41smejkarlinkissue30710 messages
2017-06-21 10:08:40smejkarcreate