[issue4194] Miserable subprocess.Popen performance

Winfried Plappert report at bugs.python.org
Sat Oct 25 15:23:40 CEST 2008


Winfried Plappert <Winfried.Plappert at gmx.de> added the comment:

The created testfile size is 588890 bytes, which implies that
subprocess.Popen reads the file in completely unbuffered mode, one byte
at a time. If I modify the popentest.py programme by specifying a
bufsize of 1_000_000, the execution time drops quite a bit:
time with os.popen         0.069 sec
time with subprocess.Popen 0.118 sec
This Solaris 9/Python 2.6.

I think I have got it: Lib/subprocess.py should have a default bufsize
of -1, not 0! I tested it by modifying the subprocess.Popen call and
here is the result:
time with os.popen         0.086 sec
time with subprocess.Popen 0.080 sec

See also Modules/posixmodule.c.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4194>
_______________________________________


More information about the Python-bugs-list mailing list