Mercurial > hg
changeset 49681:c261a628e525
delta-find: use a single snapshot cache when applying a group to an object
This will avoid walking the revlog over and over again in some situations.
The difference is hard to show in our current benchmark suite, as the gain is
lower than their overall instability.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 06 Nov 2022 17:53:17 -0500 |
parents | 40e24d82b513 |
children | 1e6c37360527 |
files | mercurial/revlogutils/deltas.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py Sun Nov 06 17:55:55 2022 -0500 +++ b/mercurial/revlogutils/deltas.py Sun Nov 06 17:53:17 2022 -0500 @@ -664,6 +664,7 @@ cachedelta, excluded_bases=None, target_rev=None, + snapshot_cache=None, ): """Provides group of revision to be tested as delta base @@ -689,6 +690,7 @@ p1, p2, cachedelta, + snapshot_cache=snapshot_cache, ) while True: temptative = candidates.send(good) @@ -799,7 +801,7 @@ yield None -def _refinedgroups(revlog, p1, p2, cachedelta): +def _refinedgroups(revlog, p1, p2, cachedelta, snapshot_cache=None): good = None # First we try to reuse a the delta contained in the bundle. # (or from the source revlog) @@ -819,8 +821,8 @@ debug_info['cached-delta.accepted'] += 1 yield None return - # XXX cache me higher - snapshot_cache = SnapshotCache() + if snapshot_cache is None: + snapshot_cache = SnapshotCache() groups = _rawgroups( revlog, p1, @@ -1053,6 +1055,7 @@ self._write_debug = write_debug self._debug_search = debug_search self._debug_info = debug_info + self._snapshot_cache = SnapshotCache() def buildtext(self, revinfo, fh): """Builds a fulltext version of a revision @@ -1265,6 +1268,7 @@ cachedelta, excluded_bases, target_rev, + snapshot_cache=self._snapshot_cache, ) candidaterevs = next(groups) while candidaterevs is not None: