Rev 3690: (jam) Use list.append(str) instead of list += str when buffering sftp in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Sep 4 19:04:50 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3690
revision-id: pqm at pqm.ubuntu.com-20080904180441-gssfmn0j6yw2vi0e
parent: pqm at pqm.ubuntu.com-20080904142234-pldim6ie032cb6am
parent: john at arbash-meinel.com-20080904173412-kfkpexgdopfwm9cz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-09-04 19:04:41 +0100
message:
(jam) Use list.append(str) instead of list += str when buffering sftp
reads.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
------------------------------------------------------------
revno: 3688.1.2
revision-id: john at arbash-meinel.com-20080904173412-kfkpexgdopfwm9cz
parent: john at arbash-meinel.com-20080904024234-bgqpx4oupmqhv5t9
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Thu 2008-09-04 12:34:12 -0500
message:
NEWS entry for the sftp tweak.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3688.1.1
revision-id: john at arbash-meinel.com-20080904024234-bgqpx4oupmqhv5t9
parent: pqm at pqm.ubuntu.com-20080903223056-b108iytb38xkznci
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2008-09-03 21:42:34 -0500
message:
Properly append the data to the list buffer.
Rather than using [] += 'str', use [].append(str).
It turns out both *work*, but the former adds each character
individually to the list.
modified:
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
=== modified file 'NEWS'
--- a/NEWS 2008-09-03 22:30:56 +0000
+++ b/NEWS 2008-09-04 17:34:12 +0000
@@ -39,6 +39,12 @@
to recover if you realize you uncommitted the wrong thing.
(John Arbash Meinel)
+ * ``SFTPTransport.readv()`` was accidentally using ``list += string``,
+ which 'works', but adds each character separately to the list,
+ rather than using ``list.append(string)``. Fixing this makes the
+ SFTP transport a little bit faster (~20%) and use a bit less memory.
+ (John Arbash Meinel)
+
* When reading index files, if we happen to read the whole file in a
single request treat it as a ``_buffer_all`` request. This happens
most often on small indexes over remote transports, where we default
=== modified file 'bzrlib/transport/sftp.py'
--- a/bzrlib/transport/sftp.py 2008-07-18 19:51:08 +0000
+++ b/bzrlib/transport/sftp.py 2008-09-04 02:42:34 +0000
@@ -329,7 +329,7 @@
cur_offset_and_size = offset_stack.next()
for data in fp.readv(requests):
- cur_data += data
+ cur_data.append(data)
cur_data_len += len(data)
if cur_data_len < cur_coalesced.length:
More information about the bazaar-commits
mailing list