creating size-limited tar files

andrea crotti andrea.crotti.0 at gmail.com
Wed Nov 14 16:56:28 CET 2012


Ok this is all very nice, but:

[andrea at andreacrotti tar_baller]$ time python2 test_pipe.py > /dev/null

real	0m21.215s
user	0m0.750s
sys	0m1.703s

[andrea at andreacrotti tar_baller]$ time ls -lR /home/andrea | cat > /dev/null

real	0m0.986s
user	0m0.413s
sys	0m0.600s


where test_pipe.py is:
from subprocess import PIPE, Popen

# check if doing the pipe with subprocess and with the | is the same or not

pipe_file = open('pipefile', 'w')


p1 = Popen('ls -lR /home/andrea', shell=True, stdout=PIPE, stderr=PIPE)
p2 = Popen('cat', shell=True, stdin=p1.stdout, stdout=PIPE, stderr=PIPE)
p1.stdout.close()

print(p2.stdout.read())


So apparently it's way slower than using this system, is this normal?


More information about the Python-list mailing list