Mercurial > public > mercurial-scm > hg-stable
diff mercurial/treediscovery.py @ 49082:f054a557aab8
discovery: also audit the number of queries done
In addition to the number of roundtrip, we now also track the number of queries
we perform, this is useful to assert the tradeoff between number of roundtrip and
the number of queries.
Differential Revision: https://phab.mercurial-scm.org/D12398
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 14 Mar 2022 05:59:20 +0100 |
parents | 6000f5b25c9b |
children | d44e3c45f0e4 |
line wrap: on
line diff
--- a/mercurial/treediscovery.py Sun Mar 13 16:10:53 2022 +0100 +++ b/mercurial/treediscovery.py Mon Mar 14 05:59:20 2022 +0100 @@ -39,6 +39,7 @@ if audit is not None: audit[b'total-roundtrips'] = 1 + audit[b'total-queries'] = 0 if repo.changelog.tip() == repo.nullid: base.add(repo.nullid) @@ -69,6 +70,8 @@ # head, root, first parent, second parent # (a branch always has two parents (or none) by definition) with remote.commandexecutor() as e: + if audit is not None: + audit[b'total-queries'] += len(unknown) branches = e.callcommand(b'branches', {b'nodes': unknown}).result() unknown = collections.deque(branches) @@ -115,10 +118,13 @@ ) for p in pycompat.xrange(0, len(r), 10): with remote.commandexecutor() as e: + subset = r[p : p + 10] + if audit is not None: + audit[b'total-queries'] += len(subset) branches = e.callcommand( b'branches', { - b'nodes': r[p : p + 10], + b'nodes': subset, }, ).result() @@ -135,6 +141,8 @@ progress.increment() with remote.commandexecutor() as e: + if audit is not None: + audit[b'total-queries'] += len(search) between = e.callcommand(b'between', {b'pairs': search}).result() for n, l in zip(search, between):