Author: Justin Peel <notmuchtot...@gmail.com> Branch: Changeset: r46914:c7da5730f011 Date: 2011-08-30 00:35 -0600 http://bitbucket.org/pypy/pypy/changeset/c7da5730f011/
Log: speed up for tarfile. pypy doesn't like adding empty strings. diff --git a/lib-python/modified-2.7/tarfile.py b/lib-python/modified-2.7/tarfile.py --- a/lib-python/modified-2.7/tarfile.py +++ b/lib-python/modified-2.7/tarfile.py @@ -265,7 +265,6 @@ if length is None: shutil.copyfileobj(src, dst) return - BUFSIZE = 16 * 1024 blocks, remainder = divmod(length, BUFSIZE) for b in xrange(blocks): @@ -802,19 +801,19 @@ if self.closed: raise ValueError("I/O operation on closed file") - buf = "" if self.buffer: if size is None: - buf = self.buffer + buf = self.buffer + self.fileobj.read() self.buffer = "" else: buf = self.buffer[:size] self.buffer = self.buffer[size:] - - if size is None: - buf += self.fileobj.read() + buf += self.fileobj.read(size - len(buf)) else: - buf += self.fileobj.read(size - len(buf)) + if size is None: + buf = self.fileobj.read() + else: + buf = self.fileobj.read(size) self.position += len(buf) return buf _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit