changegroup: don't try to prune manifest nodes if not ellipses
authorPulkit Goyal <pulkit@yandex-team.ru>
Thu, 31 Jan 2019 20:11:16 +0300
changeset 41730 5f9d057ba28c
parent 41729 a87ca1d7e61d
child 41731 6704696141b8
changegroup: don't try to prune manifest nodes if not ellipses In non-ellipses case, the number of manifest nodes can be very big, and finding whether one of them can be pruned or not is very costly. For each node, we try to find the rev and the linkrev, which is expensive. Sending bit more manifest nodes seems better and much faster here. On our internal repository, this saves around 5 seconds on `hg tracked --addinclude <some_path>` on a narrow repo with ellipses disabled. Differential Revision: https://phab.mercurial-scm.org/D5782
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Mon Feb 11 16:34:48 2019 +0300
+++ b/mercurial/changegroup.py	Thu Jan 31 20:11:16 2019 +0300
@@ -1073,6 +1073,11 @@
                 # because of narrow clones). Do this even for the root
                 # directory (tree=='')
                 prunednodes = []
+            elif not self._ellipses:
+                # In non-ellipses case and large repositories, it is better to
+                # prevent calling of store.rev and store.linkrev on a lot of
+                # nodes as compared to sending some extra data
+                prunednodes = nodes.copy()
             else:
                 # Avoid sending any manifest nodes we can prove the
                 # client already has by checking linkrevs. See the