Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 42467:c1c1872d25d1
deltas: skip if projected compressed size does not match text size constraint
If we have a delta, we check constraints against a lower bound estimate of the
resulting compressed delta. We then checks this projected size against the ??
size constraints. This allows to exclude potential base candidates before doing
any expensive computation.
This only apply to the intermediate-snapshot case since this constraint only apply to
them.
For some pathological cases of a private repository this step provide a
further performance boost (timing from `hg perfrevlogwrite`):
before: 3.145906 seconds
after: 3.010646 seconds
author | Valentin Gatien-Baron <vgatien-baron@janestreet.com> |
---|---|
date | Mon, 21 Jan 2019 22:46:18 +0100 |
parents | 465f2d0df9ae |
children | 9b5fbe5ead89 |
comparison
equal
deleted
inserted
replaced
42466:465f2d0df9ae | 42467:c1c1872d25d1 |
---|---|
958 currentbase = self.revlog.deltaparent(currentbase) | 958 currentbase = self.revlog.deltaparent(currentbase) |
959 if self.revlog._lazydelta and currentbase == base: | 959 if self.revlog._lazydelta and currentbase == base: |
960 delta = revinfo.cachedelta[1] | 960 delta = revinfo.cachedelta[1] |
961 if delta is None: | 961 if delta is None: |
962 delta = self._builddeltadiff(base, revinfo, fh) | 962 delta = self._builddeltadiff(base, revinfo, fh) |
963 # snapshotdept need to be neither None nor 0 level snapshot | |
964 if revlog.upperboundcomp is not None and snapshotdepth: | |
965 lowestrealisticdeltalen = len(delta) // revlog.upperboundcomp | |
966 snapshotlimit = revinfo.textlen >> snapshotdepth | |
967 if snapshotlimit < lowestrealisticdeltalen: | |
968 return None | |
963 header, data = revlog.compress(delta) | 969 header, data = revlog.compress(delta) |
964 deltalen = len(header) + len(data) | 970 deltalen = len(header) + len(data) |
965 offset = revlog.end(len(revlog) - 1) | 971 offset = revlog.end(len(revlog) - 1) |
966 dist = deltalen + offset - revlog.start(chainbase) | 972 dist = deltalen + offset - revlog.start(chainbase) |
967 chainlen, compresseddeltalen = revlog._chaininfo(base) | 973 chainlen, compresseddeltalen = revlog._chaininfo(base) |