[Patches] [ python-Patches-533482 ] small seek tweak upon reads (gzip)

noreply@sourceforge.net noreply@sourceforge.net
Sun, 24 Mar 2002 17:21:36 -0800


Patches item #533482, was opened at 2002-03-22 03:04
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=533482&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
Status: Closed
Resolution: Rejected
Priority: 5
Submitted By: Todd Warner (icode)
Assigned to: Neil Schemenauer (nascheme)
Summary: small seek tweak upon reads (gzip)

Initial Comment:
Upon actual read of a gzipped file, there is a check
to see if you are already at the end of the file. This
is done by saving your position, seeking to the end,
and comparing that tell(). It is more efficient to
simply increment position + 1.

Efficiency gain is nearly insignificant, but this
patch will greatly decrease the size of my next one. :)

NOTE: all version of gzip.py do this.

----------------------------------------------------------------------

>Comment By: Todd Warner (icode)
Date: 2002-03-24 20:21

Message:
Logged In: YES 
user_id=87721

It is more efficient for the majority of gzipped files
(if very small files are not in the majority).

The "real" patch will be (once I give it a bit more
polish/tuning --- using in production code soon) a class
called GzipStream. Ie. it will allow high level access to
any arbitrary file-like "stream" (eg. a gzipped
socket stream) which are not generally "seekable". I do
this via inheriting GzipFile and extending upon it...
but I rewrite the _read method with a one line change.

Anyway, that is my logic. Question to you: should this be
included within gzip.py or in its own module (eg. 
gzipstream)?


----------------------------------------------------------------------

Comment By: Neil Schemenauer (nascheme)
Date: 2002-03-24 17:35

Message:
Logged In: YES 
user_id=35752

This looks like a pointless change to me.  It's probably
less efficient with the patch because there is an extra
Python int add.  Why don't you just submit the real patch? :)

Rejected.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=533482&group_id=5470