phases: stop using `repo.set` in `remotephasessummary`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 05 Apr 2024 12:24:47 +0200
changeset 51582 d8287e43540f
parent 51581 e0194b3ea312
child 51583 22cc679a7312
phases: stop using `repo.set` in `remotephasessummary` The `repository.set` create changectx on the fly, an expensive operation. Using `repo.revs` and a direct rev-num → node-id translation will be significantly faster. This is especially true as we prepare ourself to no longer do the rev-num → node-id transalation there. The speedup is a bit lost in the overall noisyness of the slow phase discovery algorithm, but it save a small amount of time in my benchmark.
mercurial/phases.py
--- a/mercurial/phases.py	Fri Apr 05 12:02:43 2024 +0200
+++ b/mercurial/phases.py	Fri Apr 05 12:24:47 2024 +0200
@@ -1154,8 +1154,8 @@
         self.publicheads = [to_node(r) for r in heads]
         self.draftroots = [to_node(r) for r in roots]
         # Get the list of all "heads" revs draft on remote
-        dheads = unfi.set(b'heads(%ld::%ld)', roots, remote_subset)
-        self.draftheads = [c.node() for c in dheads]
+        dheads = unfi.revs(b'heads(%ld::%ld)', roots, remote_subset)
+        self.draftheads = [to_node(r) for r in dheads]
 
 
 def new_heads(