mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
With --compression auto,C, only use C if lz4 achieves at least 3% compression
This commit is contained in:
parent
83de89d186
commit
48652a65a6
1 changed files with 2 additions and 2 deletions
|
@ -2162,13 +2162,13 @@ def heuristic_lz4(self, compr_args, chunk):
|
|||
cdata = lz4.compress(data)
|
||||
data_len = len(data)
|
||||
cdata_len = len(cdata)
|
||||
if cdata_len < data_len:
|
||||
if cdata_len < 0.97 * data_len:
|
||||
compr_spec = compr_args.spec
|
||||
else:
|
||||
# uncompressible - we could have a special "uncompressible compressor"
|
||||
# that marks such data as uncompressible via compression-type metadata.
|
||||
compr_spec = CompressionSpec('none')
|
||||
self.logger.debug("len(data) == %d, len(lz4(data)) == %d, choosing %s", data_len, cdata_len, compr_spec)
|
||||
self.logger.debug("len(data) == %d, len(lz4(data)) == %d, ratio == %.3f, choosing %s", data_len, cdata_len, cdata_len/data_len, compr_spec)
|
||||
meta['compress'] = compr_spec
|
||||
return compr_spec, Chunk(data, **meta)
|
||||
|
||||
|
|
Loading…
Reference in a new issue