2013/7/26 Antoine Pitrou <solip...@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)
"""

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

"python -c pass" takes 19,000 µs (0.019 sec) on my PC. It uses 207
syscalls creating file descriptors (open() and openat()): 67 are
successful, 140 are failing with ENOENT. The estimated overhead on
"python -c pass" is 0.2*67=13.4 µs (0.07%).

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

Reply via email to