comparison mercurial/upgrade_utils/actions.py @ 46874:84a93fa7ecfd

revlog-compression: use zstd by default (if available) As see in changeset bb271ec2fbfb, zstd is 20% to 50% faster for reading and writing. Use take advantage of the new config behavior to try zstd by default, falling back to zlib is zstd is not available on that plateform. Differential Revision: https://phab.mercurial-scm.org/D10326
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 06 Apr 2021 18:55:19 +0200
parents 3aa78f2aea48
children 856820b497fc
comparison
equal deleted inserted replaced
46873:0abf5eba0042 46874:84a93fa7ecfd
393 @staticmethod 393 @staticmethod
394 def fromconfig(repo): 394 def fromconfig(repo):
395 return True 395 return True
396 396
397 397
398 _has_zstd = (
399 b'zstd' in util.compengines
400 and util.compengines[b'zstd'].available()
401 and util.compengines[b'zstd'].revlogheader()
402 )
403
404
398 @registerformatvariant 405 @registerformatvariant
399 class compressionengine(formatvariant): 406 class compressionengine(formatvariant):
400 name = b'compression' 407 name = b'compression'
401 default = b'zlib' 408
409 if _has_zstd:
410 default = b'zstd'
411 else:
412 default = b'zlib'
402 413
403 description = _( 414 description = _(
404 b'Compresion algorithm used to compress data. ' 415 b'Compresion algorithm used to compress data. '
405 b'Some engine are faster than other' 416 b'Some engine are faster than other'
406 ) 417 )