# HG changeset patch # User Boris Feld # Date 1542710295 0 # Node ID 300f8564220ff259693d59711e868f1c5c8a426b # Parent 594e84a2e57455ffa2069c9945e91ca737c74ca7 tags: cache `repo.changelog` access when checking tags nodes The tags reading process checks if the nodes referenced in tags exist. Caching the access to `repo.changelog` provides a large speedup for repositories with many tags. running `hg perftags` in a large private repository before: ! wall 0.393464 comb 0.390000 user 0.330000 sys 0.060000 (median of 25) after: ! wall 0.267711 comb 0.270000 user 0.210000 sys 0.060000 (median of 38) diff -r 594e84a2e574 -r 300f8564220f mercurial/localrepo.py --- a/mercurial/localrepo.py Tue Nov 20 10:46:20 2018 +0000 +++ b/mercurial/localrepo.py Tue Nov 20 10:38:15 2018 +0000 @@ -1417,10 +1417,11 @@ tags, tt = self._findtags() else: tags = self._tagscache.tags + rev = self.changelog.rev for k, v in tags.iteritems(): try: # ignore tags to unknown nodes - self.changelog.rev(v) + rev(v) t[k] = v except (error.LookupError, ValueError): pass