Mercurial > hg-stable
changeset 30281:d92777f98524
changegroup: cache changelog and manifestlog outside of loop
History has taught us that repo.changelog can add significant overhead
to loops. So cache the changelog instance outside of the loop to
avoid the lookup. While we're here, do the same for manifestlog,
since each loop would otherwise initialize a new manifestlog instance.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 01 Nov 2016 18:28:03 -0700 |
parents | 730c7fc8889a |
children | dc7c4dbc1af9 |
files | mercurial/changegroup.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Tue Nov 01 18:49:23 2016 -0700 +++ b/mercurial/changegroup.py Tue Nov 01 18:28:03 2016 -0700 @@ -330,11 +330,12 @@ needfiles = {} if repo.ui.configbool('server', 'validate', default=False): + cl = repo.changelog + ml = repo.manifestlog # validate incoming csets have their manifests for cset in xrange(clstart, clend): - mfnode = repo.changelog.read( - repo.changelog.node(cset))[0] - mfest = repo.manifestlog[mfnode].readdelta() + mfnode = cl.read(cl.node(cset))[0] + mfest = ml[mfnode].readdelta() # store file nodes we must see for f, n in mfest.iteritems(): needfiles.setdefault(f, set()).add(n)