[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)

Antoine Pitrou solipsis at pitrou.net
Fri Jul 26 23:24:32 CEST 2013


On Fri, 26 Jul 2013 22:17:47 +0200
Victor Stinner <victor.stinner at gmail.com> wrote:

> 2013/7/26 Antoine Pitrou <solipsis at pitrou.net>:
> >> The main drawback is the additionnal syscalls: on some platforms, 2
> >> additional syscalls are need to make a file descriptor non-inheritable
> >> for each creation of file descriptor. According to my benchmark on the
> >> implementation of the PEP 433: the overhead of making a file
> >> descriptor non-inheritable is between 1% and 3% (7.8 µs => 7.9 or 8.0
> >> µs) on Linux 3.6.
> >
> > 1% and 3% of what?
> > You're telling us there's a 0.1µs overhead. It's positively tiny.
> 
> Copy-paste of the link:
> 
> """
> 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?
Benchmarking is useless if you aren't telling us what exactly you are
benchmarking.

> The overhead is between 0.1 and 0.2 µs (100 and 200 ns) according to
> my micro-benchmark.

That's what I figured out (see above). It's tiny.

Antoine.


More information about the Python-Dev mailing list