]> arthur.barton.de Git - bup.git/commit
hashsplit: avoid cat_bytes() if possible
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 28 Apr 2020 21:35:33 +0000 (23:35 +0200)
committerRob Browning <rlb@defaultvalue.org>
Sun, 21 Jun 2020 16:20:58 +0000 (11:20 -0500)
commitd83b0a2939617be2ed1602f8cf746334a73697ee
tree0ef2ad37c3284c86391258eecdecccb711179e90
parentfc5518c3179ac4ea958a455ad4b931e22c32e216
hashsplit: avoid cat_bytes() if possible

If our current buffer is empty, there's no need to cat_bytes()
it with the new buffer, we can just replace the empty one with
the new one. This saves the memcpy() in many cases. Especially
if the whole file was read in one chunk (by bumping up the read
size) this saves a lot of time.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/hashsplit.py