Speed of shutil.copy vs os.system("copy src dest") in win32

R

Russell Warren

I just did a comparison of the copying speed of shutil.copy against the
speed of a direct windows copy using os.system. I copied a file that
was 1083 KB.

I'm very interested to see that the shutil.copy copyfileobj
implementation of hacking through the file and writing a new one is
significantly faster... any clue as to why this is? I figure I'm
missing something here.

Does os.system launch a cmd shell every time?
[0.99285104671434965, 0.68337121058721095, 0.84528340892575216,
0.87780765432398766, 0.8709894693311071][2.8546278926514788, 2.3763950446300441, 2.4444609580241377,
2.4392499605455669, 2.4446956247265916]
 
T

Tim Roberts

Russell Warren said:
I just did a comparison of the copying speed of shutil.copy against the
speed of a direct windows copy using os.system. I copied a file that
was 1083 KB.

I'm very interested to see that the shutil.copy copyfileobj
implementation of hacking through the file and writing a new one is
significantly faster... any clue as to why this is? I figure I'm
missing something here.

Does os.system launch a cmd shell every time?

Yes. That's in the documentation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top