[Updated] [++- ] D9283: bundle: optional multithreaded compression, ATM zstd-only
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Fri Feb 5 11:22:16 UTC 2021
joerg.sonnenberger updated this revision to Diff 25495.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9283?vs=23435&id=25495
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9283/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9283
AFFECTED FILES
mercurial/commands.py
mercurial/configitems.py
mercurial/utils/compression.py
relnotes/5.7
relnotes/next
tests/test-bundle-type.t
CHANGE DETAILS
diff --git a/tests/test-bundle-type.t b/tests/test-bundle-type.t
--- a/tests/test-bundle-type.t
+++ b/tests/test-bundle-type.t
@@ -201,6 +201,15 @@
(see 'hg help bundlespec' for supported values for --type)
[10]
+zstd supports threading
+
+ $ hg init test-compthreads
+ $ cd test-compthreads
+ $ hg debugbuilddag +3
+ $ hg --config experimental.bundlecompthreads=1 bundle -a -t zstd-v2 zstd-v2-threaded.hg
+ 3 changesets found
+ $ cd ..
+
#else
zstd is a valid engine but isn't available
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -5,6 +5,11 @@
* The `rev-branch-cache` is now updated incrementally whenever changesets
are added.
+ * The new options `experimental.bundlecompthreads` and
+ `experimental.bundlecompthreads.<engine>` can be used to instruct
+ the compression engines for bundle operations to use multiple threads
+ for compression. The default is single threaded operation. Currently
+ only supported for zstd.
== New Experimental Features ==
diff --git a/relnotes/5.7 b/relnotes/5.7
--- a/relnotes/5.7
+++ b/relnotes/5.7
@@ -51,6 +51,11 @@
* The `rev-branch-cache` is now updated incrementally whenever changesets
are added.
+ * The new options `experimental.bundlecompthreads` and
+ `experimental.bundlecompthreads.<engine>` can be used to instruct
+ the compression engines for bundle operations to use multiple threads
+ for compression. The default is single threaded operation. Currently
+ only supported for zstd.
== New Experimental Features ==
diff --git a/mercurial/utils/compression.py b/mercurial/utils/compression.py
--- a/mercurial/utils/compression.py
+++ b/mercurial/utils/compression.py
@@ -685,9 +685,11 @@
# while providing no worse compression. It strikes a good balance
# between speed and compression.
level = opts.get(b'level', 3)
+ # default to single-threaded compression
+ threads = opts.get(b'threads', 0)
zstd = self._module
- z = zstd.ZstdCompressor(level=level).compressobj()
+ z = zstd.ZstdCompressor(level=level, threads=threads).compressobj()
for chunk in it:
data = z.compress(chunk)
if data:
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -850,6 +850,31 @@
)
coreconfigitem(
b'experimental',
+ b'bundlecompthreads',
+ default=None,
+)
+coreconfigitem(
+ b'experimental',
+ b'bundlecompthreads.bzip2',
+ default=None,
+)
+coreconfigitem(
+ b'experimental',
+ b'bundlecompthreads.gzip',
+ default=None,
+)
+coreconfigitem(
+ b'experimental',
+ b'bundlecompthreads.none',
+ default=None,
+)
+coreconfigitem(
+ b'experimental',
+ b'bundlecompthreads.zstd',
+ default=None,
+)
+coreconfigitem(
+ b'experimental',
b'changegroup3',
default=False,
)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1649,6 +1649,14 @@
if complevel is not None:
compopts[b'level'] = complevel
+ compthreads = ui.configint(
+ b'experimental', b'bundlecompthreads.' + bundlespec.compression
+ )
+ if compthreads is None:
+ compthreads = ui.configint(b'experimental', b'bundlecompthreads')
+ if compthreads is not None:
+ compopts[b'threads'] = compthreads
+
# Bundling of obsmarker and phases is optional as not all clients
# support the necessary features.
cfg = ui.configbool
To: joerg.sonnenberger, #hg-reviewers
Cc: indygreg, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210205/38f0b031/attachment-0001.html>
More information about the Mercurial-patches
mailing list