Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 41108:38e88450138c
delta: have a native implementation of _findsnapshot
The function might traverse a lot of revision, a native implementation get
significantly faster.
example affected manifest write
before: 0.114989
after: 0.067141 (-42%)
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 20 Dec 2018 10:15:20 +0100 |
parents | 88d813cd9acd |
children | 3e1960e23e6b |
comparison
equal
deleted
inserted
replaced
41107:3e2c02836420 | 41108:38e88450138c |
---|---|
28 ) | 28 ) |
29 | 29 |
30 from .. import ( | 30 from .. import ( |
31 error, | 31 error, |
32 mdiff, | 32 mdiff, |
33 util, | |
33 ) | 34 ) |
34 | 35 |
35 # maximum <delta-chain-data>/<revision-text-length> ratio | 36 # maximum <delta-chain-data>/<revision-text-length> ratio |
36 LIMIT_DELTA2TEXT = 2 | 37 LIMIT_DELTA2TEXT = 2 |
37 | 38 |
686 good = yield tuple(group) | 687 good = yield tuple(group) |
687 yield None | 688 yield None |
688 | 689 |
689 def _findsnapshots(revlog, cache, start_rev): | 690 def _findsnapshots(revlog, cache, start_rev): |
690 """find snapshot from start_rev to tip""" | 691 """find snapshot from start_rev to tip""" |
691 deltaparent = revlog.deltaparent | 692 if util.safehasattr(revlog.index, 'findsnapshots'): |
692 issnapshot = revlog.issnapshot | 693 revlog.index.findsnapshots(cache, start_rev) |
693 for rev in revlog.revs(start_rev): | 694 else: |
694 if issnapshot(rev): | 695 deltaparent = revlog.deltaparent |
695 cache[deltaparent(rev)].append(rev) | 696 issnapshot = revlog.issnapshot |
697 for rev in revlog.revs(start_rev): | |
698 if issnapshot(rev): | |
699 cache[deltaparent(rev)].append(rev) | |
696 | 700 |
697 def _refinedgroups(revlog, p1, p2, cachedelta): | 701 def _refinedgroups(revlog, p1, p2, cachedelta): |
698 good = None | 702 good = None |
699 # First we try to reuse a the delta contained in the bundle. | 703 # First we try to reuse a the delta contained in the bundle. |
700 # (or from the source revlog) | 704 # (or from the source revlog) |