New submission from STINNER Victor: Attached patch avoids a syscall on socket.setblocking() and socket.settimeout() when possible: use ioctl(FIONBIO) when available (not only on VMS), or use fcntl() but only call fcntl() twice if the flags changed.
The fcntl() optimization was suggested by Peter Portante some months ago: https://mail.python.org/pipermail/python-dev/2013-January/123661.html See also the rejected issue #19813: "Add a new optional timeout parameter to socket.socket() constructor". ---------- components: Library (Lib) files: socket.patch keywords: patch messages: 204698 nosy: haypo priority: normal severity: normal status: open title: Optimize socket.settimeout() and socket.setblocking(): avoid syscall type: performance versions: Python 3.4 Added file: http://bugs.python.org/file32882/socket.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19827> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com