Issue 13031: small speed-up for tarfile.py when unzipping tarballs (original) (raw)

Created on 2011-09-23 04:48 by jpeel, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cpython_tarfile.diff jpeel,2011-09-23 04:48 review
cpython_tarfile2.diff jpeel,2011-09-23 18:32 review
Messages (6)
msg144436 - (view) Author: Justin Peel (jpeel) Date: 2011-09-23 04:48
Attached small diff speeds up extracting a gzipped tarball on my machine using python 3.2 by 3-5%. It will probably be a larger percentage on machines that have faster hard drives (mine is 5400rpm). Basically, the changes speed up calculating the checksums by only doing one slice rather than four and call struct.unpack twice rather than four times. We are able to use less unpack calls because 'x' means to skip a byte.
msg144442 - (view) Author: (poq) Date: 2011-09-23 13:04
I don't think you even need the slice, if you use unpack_from.
msg144466 - (view) Author: Justin Peel (jpeel) Date: 2011-09-23 18:32
poq, You're quite right. I've added that change too. By the way, four unnecessary extra tuples are no longer being created for each call to this function too because of these changes.
msg160931 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-05-16 21:01
Justin, perhaps of interest to the patch would be better if you provide any microbenchmark.
msg160992 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-17 17:53
New changeset c62fa6892424 by Ross Lagerwall in branch 'default': Issue #13031: Small speed-up for tarfile when unzipping tarfiles. http://hg.python.org/cpython/rev/c62fa6892424
msg160994 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2012-05-17 18:24
Nice work, thanks!
History
Date User Action Args
2022-04-11 14:57:21 admin set github: 57240
2012-05-17 18:24:11 rosslagerwall set status: open -> closedmessages: + assignee: lars.gustaebel -> rosslagerwallresolution: fixedstage: resolved
2012-05-17 17:53:35 python-dev set nosy: + python-devmessages: +
2012-05-16 21:01:27 serhiy.storchaka set messages: +
2012-05-16 20:33:48 rosslagerwall set nosy: + rosslagerwall
2012-04-07 16:11:56 serhiy.storchaka set nosy: + serhiy.storchaka
2011-09-23 18:32:41 jpeel set files: + cpython_tarfile2.diffmessages: +
2011-09-23 16:33:35 eric.araujo set title: [PATCH] small speed-up for tarfile.py when unzipping tarballs -> small speed-up for tarfile.py when unzipping tarballs
2011-09-23 13:04:54 poq set nosy: + poqmessages: +
2011-09-23 06:46:23 lars.gustaebel set priority: normal -> lowassignee: lars.gustaebelnosy: + lars.gustaebelversions: + Python 3.3, - Python 2.7, Python 3.2
2011-09-23 04:50:04 jpeel set type: performance
2011-09-23 04:48:55 jpeel create