[Bug 6872] New: Compression level option not making it to compressstream function of compression engine

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Mon Apr 1 17:41:54 UTC 2024


https://bz.mercurial-scm.org/show_bug.cgi?id=6872

            Bug ID: 6872
           Summary: Compression level option not making it to
                    compressstream function of compression engine
           Product: Mercurial
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: bundle2
          Assignee: bugzilla at mercurial-scm.org
          Reporter: eric-mercurial at omnifarious.org
                CC: mercurial-devel at mercurial-scm.org,
                    pierre-yves.david at ens-lyon.org
    Python Version: ---

I used this command:

hg bundle -a -t 'zstd;level=22' foo.mbdl

with data that I had explicitly formulated to compress very different with
different zstd compression levels. And I had tested that this was indeed the
case when using the zstd command line.

The resulting file was the right size for level 3, not level 22.

I went into utils/compression.py and stuck in a debugging print statement, and
the level that's being passed to _zstdengine.compressstream is 3. So, somewhere
between the command line parsing and the creation of the stream compressor, the
compression level is being lost.

It also appears that the 'revlog.zstd.level' option has no effect, possibly for
similar reasons.

This is the Python I used to create the file I checked in for testing purposes.
It's specifically designed to make sure that the compression ratio will change
at least very noticeably as the compression level being used goes up.

import itertools, random
pl = [''.join(p) for p in itertools.permutations([chr(65 + x) for x in
range(11)])]
sections = set()
while len(sections) < 3500:
    sections.add(random.randint(0, 480924 * 83))
sectstrs = ['\n'.join(pl[x:x+83]) for x in sections]
with open('permutes.txt', 'w') as pf:
    for _ in range(19):
        random.shuffle(sectstrs)
        pf.write('\n'.join(sectstrs) + '\n')

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list