]> arthur.barton.de Git - bup.git/commit
Remove inefficient (or will be) uses of buffer
authorRob Browning <rlb@defaultvalue.org>
Thu, 28 Nov 2019 08:01:02 +0000 (02:01 -0600)
committerRob Browning <rlb@defaultvalue.org>
Fri, 29 Nov 2019 22:34:10 +0000 (16:34 -0600)
commitb2f7ccd162e988a8785771a116c83b04f9ea51ce
treeb3c864b87ff08640ca4a4934128cb7080141e8ba
parentc2f10963fcaa6728bac8089c66d13f0961dcbf14
Remove inefficient (or will be) uses of buffer

On amd64 sys.getsizeof(b'') is a bit under 40 bytes across python 2/3,
while a buffer(b'') adds 64 bytes in python 2, and the memoryview(b'')
that replaces it in python 3 adds 200.  So just copy the bytes unless
the added overhead is worth it.

And while we're here, fix a few more python 3 str/bytes compatability
issues, and remove some redundant offset arithemetic by leaning on
range() a bit more.  (Not that it likely matters, but aside from being
simpler, this is apparently more efficient too, because it moves more
of the work to C).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/git.py
lib/bup/hashsplit.py
lib/bup/index.py
lib/bup/midx.py