Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/upgrade_utils/actions.py Wed Apr 07 13:31:15 2021 +0200 +++ b/mercurial/upgrade_utils/actions.py Tue Apr 06 18:55:19 2021 +0200 @@ -395,10 +395,21 @@ return True +_has_zstd = ( + b'zstd' in util.compengines + and util.compengines[b'zstd'].available() + and util.compengines[b'zstd'].revlogheader() +) + + @registerformatvariant class compressionengine(formatvariant): name = b'compression' - default = b'zlib' + + if _has_zstd: + default = b'zstd' + else: + default = b'zlib' description = _( b'Compresion algorithm used to compress data. '