]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41586: Add pipesize parameter to subprocess & F_GETPIPE_SZ and F_SETPIPE_SZ to...
authorRuben Vorderman <r.h.p.vorderman@lumc.nl>
Mon, 19 Oct 2020 23:30:02 +0000 (01:30 +0200)
committerGitHub <noreply@github.com>
Mon, 19 Oct 2020 23:30:02 +0000 (16:30 -0700)
commit23c0fb8edd16fe6d796df2853a5369fd783e05b7
treedb69e4ae0611f578233c1018a244c49ff9a51deb
parentbf838227c35212709dc43b3c3c57f8e1655c1d24
bpo-41586: Add pipesize parameter to subprocess & F_GETPIPE_SZ and F_SETPIPE_SZ to fcntl. (GH-21921)

* Add F_SETPIPE_SZ and F_GETPIPE_SZ to fcntl module
* Add pipesize parameter for subprocess.Popen class

This will allow the user to control the size of the pipes.
On linux the default is 64K. When a pipe is full it blocks for writing.
When a pipe is empty it blocks for reading. On processes that are
very fast this can lead to a lot of wasted CPU cycles. On a typical
Linux system the max pipe size is 1024K which is much better.
For high performance-oriented libraries such as xopen it is nice to
be able to set the pipe size.

The workaround without this feature is to use my_popen_process.stdout.fileno() in
conjuction with fcntl and 1031 (value of F_SETPIPE_SZ) to acquire this behavior.
Doc/library/fcntl.rst
Doc/library/subprocess.rst
Lib/subprocess.py
Lib/test/test_fcntl.py
Lib/test/test_subprocess.py
Misc/ACKS
Misc/NEWS.d/next/Library/2020-08-19-08-32-13.bpo-41586.IYjmjK.rst [new file with mode: 0644]
Modules/fcntlmodule.c