Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/deltas.py @ 40979:ba09db267cb6
delta: ignore base whose chains already don't match expectations
If we know the existing chain does not match our criteria, there is no point
to build a delta to append. This is especially useful when dealing with a full
text much smaller than its parent. In that case, the parent chain is probably
already too large.
example affected manifest write
before: 1.421005s
after: 0.815520s (-42%)
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 17 Dec 2018 10:46:37 +0100 |
parents | 42f59d3f714d |
children | b373477948df |
comparison
equal
deleted
inserted
replaced
40978:42f59d3f714d | 40979:ba09db267cb6 |
---|---|
652 continue | 652 continue |
653 if sparse and revlog.rawsize(rev) < (textlen // LIMIT_BASE2TEXT): | 653 if sparse and revlog.rawsize(rev) < (textlen // LIMIT_BASE2TEXT): |
654 continue | 654 continue |
655 # no delta for rawtext-changing revs (see "candelta" for why) | 655 # no delta for rawtext-changing revs (see "candelta" for why) |
656 if revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS: | 656 if revlog.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS: |
657 continue | |
658 # If we reach here, we are about to build and test a delta. | |
659 # The delta building process will compute the chaininfo in all | |
660 # case, since that computation is cached, it is fine to access it | |
661 # here too. | |
662 chainlen, chainsize = revlog._chaininfo(rev) | |
663 # if chain will be too long, skip base | |
664 if revlog._maxchainlen and chainlen >= revlog._maxchainlen: | |
665 continue | |
666 # if chain already have too much data, skip base | |
667 if deltas_limit < chainsize: | |
657 continue | 668 continue |
658 group.append(rev) | 669 group.append(rev) |
659 if group: | 670 if group: |
660 # XXX: in the sparse revlog case, group can become large, | 671 # XXX: in the sparse revlog case, group can become large, |
661 # impacting performances. Some bounding or slicing mecanism | 672 # impacting performances. Some bounding or slicing mecanism |