perf: add a --as-push option to perf::unbundle
This turned out to make a quite significant difference.
--- a/contrib/perf.py Fri Feb 23 06:25:09 2024 +0100
+++ b/contrib/perf.py Fri Feb 23 14:07:33 2024 +0100
@@ -3007,13 +3007,21 @@
@command(
b'perf::unbundle',
- formatteropts,
+ [
+ (b'', b'as-push', None, b'pretend the bundle comes from a push'),
+ ]
+ + formatteropts,
b'BUNDLE_FILE',
)
def perf_unbundle(ui, repo, fname, **opts):
"""benchmark application of a bundle in a repository.
- This does not include the final transaction processing"""
+ This does not include the final transaction processing
+
+ The --as-push option make the unbundle operation appears like it comes from
+ a client push. It change some aspect of the processing and associated
+ performance profile.
+ """
from mercurial import exchange
from mercurial import bundle2
@@ -3034,6 +3042,10 @@
args = getargspec(error.Abort.__init__).args
post_18415fc918a1 = "detailed_exit_code" in args
+ unbundle_source = b'perf::unbundle'
+ if opts[b'as_push']:
+ unbundle_source = b'push'
+
old_max_inline = None
try:
if not (pre_63edc384d3b7 or post_18415fc918a1):
@@ -3069,7 +3081,7 @@
repo,
gen,
tr,
- source=b'perf::unbundle',
+ source=unbundle_source,
url=fname,
)