discovery: using the new basesheads()
authorGeorges Racinet <georges.racinet@octobus.net>
Mon, 14 Jan 2019 18:52:01 +0100
changeset 41245 2a8782cc2e16
parent 41244 4856c9b8cbaf
child 41246 619ee4039bd4
discovery: using the new basesheads() Our ultimate goal is to switch eventually to a Rust implementation, but this move actually seems to increase the performance in a pure Python build. What follows is a quick measurement done on PyPy on repos prepared with `contrib/discovery-helper.sh 50 100`. Before: ! wall 0.894384 comb 0.890000 user 0.890000 sys 0.000000 (best of 11) ! wall 0.971199 comb 0.970000 user 0.950000 sys 0.020000 (max of 11) ! wall 0.927993 comb 0.925455 user 0.919091 sys 0.006364 (avg of 11) ! wall 0.921619 comb 0.920000 user 0.910000 sys 0.010000 (median of 11) After: ! wall 0.614278 comb 0.610000 user 0.610000 sys 0.000000 (best of 14) ! wall 0.789459 comb 0.790000 user 0.770000 sys 0.020000 (max of 14) ! wall 0.722765 comb 0.720000 user 0.715714 sys 0.004286 (avg of 14) ! wall 0.734448 comb 0.720000 user 0.720000 sys 0.000000 (median of 14) Differential Revision: https://phab.mercurial-scm.org/D5583
mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py	Mon Jan 14 18:36:09 2019 +0100
+++ b/mercurial/setdiscovery.py	Mon Jan 14 18:52:01 2019 +0100
@@ -229,9 +229,7 @@
         """the heads of the known common set"""
         # heads(common) == heads(common.bases) since common represents
         # common.bases and all its ancestors
-        # The presence of nullrev will confuse heads(). So filter it out.
-        return set(self._repo.revs('heads(%ld)',
-                   self._common.bases - {nullrev}))
+        return self._common.basesheads()
 
 def findcommonheads(ui, local, remote,
                     initialsamplesize=100,