tags-cache: skip the filternode step if we are not going to use it
When warming the hgtagsfnodescache, we don't need the actual result, so we can
simply skip the part that "filter" fnode we read from the cache. So provide a
quite visible speed up to the top level `hg debugupdatecache` function.
### data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog
# benchmark.name = hg.debug.debug-update-cache
# bin-env-vars.hg.flavor = default
# bin-env-vars.hg.py-re2-module = default
# benchmark.variants.pre-state = warm
before: 19.947581
after: 18.916804 (-5.17%, -1.03)
--- a/mercurial/tags.py Wed Mar 13 11:34:21 2024 +0100
+++ b/mercurial/tags.py Wed Mar 13 11:38:28 2024 +0100
@@ -83,7 +83,9 @@
def warm_cache(repo):
"""ensure the cache is properly filled"""
unfi = repo.unfiltered()
- fnoderevs(repo.ui, unfi, unfi.changelog.revs())
+ tonode = unfi.changelog.node
+ nodes = [tonode(r) for r in unfi.changelog.revs()]
+ _getfnodes(repo.ui, repo, nodes)
def fnoderevs(ui, repo, revs):