tags-fnode-cache: skip building a changectx in getfnode stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 12 Nov 2022 02:38:53 +0100
branchstable
changeset 49580 08fe5c4d4471
parent 49579 15a89b722937
child 49581 04f1dba53c96
tags-fnode-cache: skip building a changectx in getfnode Building a changectx object is costly, doing it just to retrieve the revision number is suboptimal. Directly fetching the revision number from the changelog provide a sizeable speedup to `hg debugupdatecache`. ### data-env-vars.name = mercurial-2018-08-01-zstd-sparse-revlog # benchmark.name = debug-update-cache # benchmark.variants.pre-state = warm before: 0.213229 seconds after: 0.165577 seconds (-22.35%) # data-env-vars.name = mercurial-filtered-2019-11-22-zstd-sparse-revlog before: 1.200383 seconds after: 1.071618 seconds (-10.73%) # data-env-vars.name = mozilla-central-2018-08-01-zstd-sparse-revlog before: 1.465735 seconds after: 0.923128 seconds (-37.02%) # data-env-vars.name = mozilla-try-2019-02-18-zstd-sparse-revlog before: 6.511771 seconds after: 4.507316 seconds (-30.78%) # data-env-vars.name = netbeans-2018-08-01-zstd-sparse-revlog before: 1.023007 seconds after: 0.645026 seconds (-36.95%) # data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog before: 0.381141 seconds after: 0.268654 seconds (-29.51%)
mercurial/tags.py
--- a/mercurial/tags.py	Sat Nov 12 02:38:26 2022 +0100
+++ b/mercurial/tags.py	Sat Nov 12 02:38:53 2022 +0100
@@ -761,8 +761,7 @@
         if node == self._repo.nullid:
             return node
 
-        ctx = self._repo[node]
-        rev = ctx.rev()
+        rev = self._repo.changelog.rev(node)
 
         self.lookupcount += 1