changeset 51436:827b89714a8d

perf: add a --as-push option to perf::unbundle This turned out to make a quite significant difference.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 23 Feb 2024 14:07:33 +0100
parents ad1066534237
children d1fb42a71676
files contrib/perf.py
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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,
                         )