You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With large tar file extracts I noticed that tarfile was slower than it should be. Seems in linux that for large files (10MB) truncate is not always a free operation even when it should be a no-op. ex: File is already 10mb seek to end and truncate.
I created a script to test the validity of this patch. It generates two random tar archives containing 1024 files of 10mb each. The files are randomized so disk caching should not interfere.
So to extract those 1g tar files the following was observed
Time Delta for TarFile: 148.23699307441711
Time Delta for FastTarFile: 107.71058106422424
Time Diff: 40.52641201019287 0.27338932859929255
Activity
fried commentedon Jun 3, 2016
With large tar file extracts I noticed that tarfile was slower than it should be. Seems in linux that for large files (10MB) truncate is not always a free operation even when it should be a no-op. ex: File is already 10mb seek to end and truncate.
I created a script to test the validity of this patch. It generates two random tar archives containing 1024 files of 10mb each. The files are randomized so disk caching should not interfere.
So to extract those 1g tar files the following was observed
Time Delta for TarFile: 148.23699307441711
Time Delta for FastTarFile: 107.71058106422424
Time Diff: 40.52641201019287 0.27338932859929255
fried commentedon Jun 3, 2016
I ran this on Linux ext4. I didn't see much improvement on OSX with SSD.
python-dev commentedon Jun 11, 2016
New changeset b63474aa8a5f by Łukasz Langa in branch '3.5':
Issue bpo-27194: superfluous truncate calls in tarfile.py slow down extraction
https://hg.python.org/cpython/rev/b63474aa8a5f
New changeset a4f918de25e5 by Łukasz Langa in branch 'default':
Merge 3.5, issue bpo-27194
https://hg.python.org/cpython/rev/a4f918de25e5
ambv commentedon Jun 12, 2016
Thanks for the patch, Jason. This is now merged and will be available in 3.5.2 and 3.6.