mirror of https://github.com/borgbackup/borg.git
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
|
@ -202,9 +202,9 @@ class LZ4(DecidingCompressor):
|
||||||
return NONE_COMPRESSOR, None
|
return NONE_COMPRESSOR, None
|
||||||
|
|
||||||
def decompress(self, idata):
|
def decompress(self, idata):
|
||||||
|
idata = super().decompress(idata)
|
||||||
if not isinstance(idata, bytes):
|
if not isinstance(idata, bytes):
|
||||||
idata = bytes(idata) # code below does not work with memoryview
|
idata = bytes(idata) # code below does not work with memoryview
|
||||||
idata = super().decompress(idata)
|
|
||||||
cdef int isize = len(idata)
|
cdef int isize = len(idata)
|
||||||
cdef int osize
|
cdef int osize
|
||||||
cdef int rsize
|
cdef int rsize
|
||||||
|
@ -304,9 +304,9 @@ class ZSTD(DecidingCompressor):
|
||||||
return NONE_COMPRESSOR, None
|
return NONE_COMPRESSOR, None
|
||||||
|
|
||||||
def decompress(self, idata):
|
def decompress(self, idata):
|
||||||
|
idata = super().decompress(idata)
|
||||||
if not isinstance(idata, bytes):
|
if not isinstance(idata, bytes):
|
||||||
idata = bytes(idata) # code below does not work with memoryview
|
idata = bytes(idata) # code below does not work with memoryview
|
||||||
idata = super().decompress(idata)
|
|
||||||
cdef int isize = len(idata)
|
cdef int isize = len(idata)
|
||||||
cdef unsigned long long osize
|
cdef unsigned long long osize
|
||||||
cdef unsigned long long rsize
|
cdef unsigned long long rsize
|
||||||
|
|
Loading…
Reference in New Issue