mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 23:13:25 +00:00
micro opt lz4/zstd decompress: keep memoryview a bit longer, fixes #3412
if LZ4/ZSTD.decompress gets called with a memoryview idata, keep it until after the super().decompress(idata) call, so we save one copy operation just to remove the 2 bytes long compression type header.
This commit is contained in:
parent
e8456ff7d9
commit
df23f3ed22
1 changed files with 2 additions and 2 deletions
|
@ -202,9 +202,9 @@ class LZ4(DecidingCompressor):
|
|||
return NONE_COMPRESSOR, None
|
||||
|
||||
def decompress(self, idata):
|
||||
idata = super().decompress(idata)
|
||||
if not isinstance(idata, bytes):
|
||||
idata = bytes(idata) # code below does not work with memoryview
|
||||
idata = super().decompress(idata)
|
||||
cdef int isize = len(idata)
|
||||
cdef int osize
|
||||
cdef int rsize
|
||||
|
@ -304,9 +304,9 @@ class ZSTD(DecidingCompressor):
|
|||
return NONE_COMPRESSOR, None
|
||||
|
||||
def decompress(self, idata):
|
||||
idata = super().decompress(idata)
|
||||
if not isinstance(idata, bytes):
|
||||
idata = bytes(idata) # code below does not work with memoryview
|
||||
idata = super().decompress(idata)
|
||||
cdef int isize = len(idata)
|
||||
cdef unsigned long long osize
|
||||
cdef unsigned long long rsize
|
||||
|
|
Loading…
Reference in a new issue