Patchwork D3199: util: drop write_content_size=True

login
register
mail settings
Submitter phabricator
Date April 9, 2018, 5:20 p.m.
Message ID <differential-rev-PHID-DREV-nqqw22hsnvxtzgf4yfoi-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30601/
State Superseded
Headers show

Comments

phabricator - April 9, 2018, 5:20 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is now the default in python-zstandard 0.9. While we're here,
  also add a comment about the ability to drop frame magic to save
  space.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3199

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3566,11 +3566,11 @@ 
 
     class zstdrevlogcompressor(object):
         def __init__(self, zstd, level=3):
-            # Writing the content size adds a few bytes to the output. However,
-            # it allows decompression to be more optimal since we can
-            # pre-allocate a buffer to hold the result.
-            self._cctx = zstd.ZstdCompressor(level=level,
-                                             write_content_size=True)
+            # TODO consider omitting frame magic to save 4 bytes.
+            # This writes content sizes into the frame header. That is
+            # extra storage. But it allows a correct size memory allocation
+            # to hold the result.
+            self._cctx = zstd.ZstdCompressor(level=level)
             self._dctx = zstd.ZstdDecompressor()
             self._compinsize = zstd.COMPRESSION_RECOMMENDED_INPUT_SIZE
             self._decompinsize = zstd.DECOMPRESSION_RECOMMENDED_INPUT_SIZE