[issue8873] Popen uses 333 times as much CPU as a shell pipe on Mac OS X
report at bugs.python.org
Wed Jun 2 17:32:29 CEST 2010
Hugh Secker-Walker <hughsw at users.sourceforge.net> added the comment:
OK. Using bufsize=4096 or bufsize=-1 eliminates the CPU-hogging problem on Mac OS X. Thank you.
I have to say that the Popen() doc could be better. It says: "bufsize, if given, has the same meaning as the corresponding argument to the built-in open() function!" which implies behavior like open(), which is to use the system's default buffering, generally a good thing.
I think the default of 0, meaning unbuffered, is a poor choice. I'm guessing many many Mac users are getting a big slowdown from this default behavior (as I've now discovered elsewhere in our project!). I request that you change the default to be the same as open(), i.e. use the system default.
Barring that semantic change, please add a note to the doc: "Most users will want to set bufsize=4096 for pipe-like buffering, or bufsize=1 for line-based buffering."
Thanks again for the quick response and resolution.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list