Comments
Patch
@@ -817,10 +817,17 @@ class cg2packer(cg1packer):
self._reorder = False
def deltaparent(self, revlog, rev, p1, p2, prev):
dp = revlog.deltaparent(rev)
- # avoid storing full revisions; pick prev in those cases
- # also pick prev when we can't be sure remote has dp
+ # Avoid sending full revisions when delta parent is null. Pick
+ # prev in that case. It's tempting to pick p1 in this case, as p1
+ # will be smaller in the common case. However, computing a delta
+ # against p1 may require resolving the raw text of p1, which could
+ # be expensive. The revlog caches should have prev cached, meaning
+ # less CPU for changegroup generation. There is likely room to add
+ # a flag and/or config option to control this behavior.
+ #
+ # Pick prev when we can't be sure remote has the base revision.
if dp == nullrev or (dp != p1 and dp != p2 and dp != prev):
return prev
return dp