HomePhabricator

hgtagsfnodescache: inherit fnode from parent when possible

Authored by marmoute.

Description

hgtagsfnodescache: inherit fnode from parent when possible

If a changeset does not update the content of .hgtags, it means it will use
the same file-node (for .hgtags) as its parents. In this case we can
directly reuse the parent's file-node.

We use this property when updating the hgtagsfnodescache taking a faster path
if we already have a cached value for the parents of the node we are looking
at.

Doing so provides a large performance boost when looking at a lot of fnodes,
especially on repository with very large manifest:

timing for tagsmod.fnoderevs(ui, repo, repo.changelog.revs())

mercurial: (41907 revisions, 1923 files)

before: 6.9 seconds
after:  2.7 seconds (-54%)

pypy: (96266 revisions, 5198 files)

before: 80 seconds
after:  20 seconds (-75%)

mozilla-central: (463411 revisions, 272080 files)

before: 7166.4 seconds
after:    47.8 seconds (-99%, x150 speedup)

On a copy of mozilla-try with about 35K heads ans 1.7M changesets, this moves
the computation from many hours to a couple of minutes, making it more
interesting to do a full warm up of this cache before computing tags (from a
cold cache).

There seems to be other performance low hanging fruits, like avoiding the use of
changectx or a more revision centric logic. However, the new code is fast enough
for my needs right now.

Details

Committed
marmouteMar 10 2019, 8:10 PM
Parents
rHG2930b31383af: hgtagsfnodescache: handle nullid lookup
Branches
Unknown
Tags
Unknown