2013/7/26 Antoine Pitrou <solip...@pitrou.net>: > On Fri, 26 Jul 2013 22:17:47 +0200 >> """ >> On Linux, setting the close-on-flag has a low overhead on >> performances. Results of bench_cloexec.py on Linux 3.6: >> >> - close-on-flag not set: 7.8 us >> - O_CLOEXEC: 1% slower (7.9 us) >> - ioctl(): 3% slower (8.0 us) >> - fcntl(): 3% slower (8.0 us) >> """ > > You aren't answering my question: slower than what?
Ah, you didn't understand the labels. bench_cloexec.py runs a benchmark on os.open(path, os.O_RDONLY, cloexec=False) and os.open(path, os.O_RDONLY, cloexec=True) with different implementation of making the file descriptor non-inheritable. close-on-flag not set: 7.8 us => C code: open(path, O_RDONLY) O_CLOEXEC: 1% slower (7.9 us) => C code: open(path, O_RDONLY|CLOEXEC) => 1% slower than open(path, O_RDONLY) ioctl(): 3% slower (8.0 us) => C code: fd=open(path, O_RDONLY); ioctl(fd, FIOCLEX, 0) => 3% slower than open(path, O_RDONLY) fcntl(): 3% slower (8.0 us) => C code: fd=open(path, O_RDONLY); flags = fcntl(fd, F_GETFD); fcntl(fd, F_SETFD, flags | FD_CLOEXEC) => 3% slower than open(path, O_RDONLY) Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com