Message75173
I noticed a colleague at work today checked in a change to his code to
switch back from subprocess.Popen to os.popen. I asked him about it and he
reported that subprocess.Popen was about 10x slower than os.popen. I asked
him for a simple test case, which is attached. Here are my results with
Python 2.4 through 2.7 (aka CVS HEAD):
tmp% python2.4 popentest.py
time with os.popen : 0.09
time with subprocess.Popen : 2.27
tmp% python2.5 popentest.py
time with os.popen : 0.03
time with subprocess.Popen : 1.52
tmp% python2.6 popentest.py
time with os.popen : 0.038824
time with subprocess.Popen : 1.517056
tmp% python2.7 popentest.py
time with os.popen : 0.033746
time with subprocess.Popen : 1.512331
These times are on my Mac laptop, all writing to the local disk. It seems
there was a bit of improvement in the 2.5 release but that it is still
miserably slow when compared with os.popen.
His original test used time.clock() as the timer. I changed to time.time()
but got essentially the same result.
Skip |
File name |
Uploaded |
popentest.py
|
skip.montanaro,
2008-10-24.17:54:39
|
|
Date |
User |
Action |
Args |
2008-10-24 17:54:42 | skip.montanaro | set | recipients:
+ skip.montanaro |
2008-10-24 17:54:41 | skip.montanaro | link | issue4194 messages |
2008-10-24 17:54:40 | skip.montanaro | create | |
|