comparison mercurial/revlog.py @ 14365:a8e3931e3fb5

revlog: linearize created changegroups in generaldelta revlogs This greatly improves the speed of the bundling process, and often reduces the bundle size considerably. (Although if the repository is already ordered, this has little effect on both time and bundle size.) For non-generaldelta clients, the reduced bundle size translates to a reduced repository size, similar to shrinking the revlogs (which uses the exact same algorithm). For generaldelta clients the difference is minor. When the new bundle format comes, reordering will not be necessary since we can then store the deltaparent relationsships directly. The eventual default behavior for clients and servers is presented in the table below, where "new" implies support for GD as well as the new bundle format: old client new client old server old bundle, no reorder old bundle, no reorder new server, non-GD old bundle, no reorder[1] old bundle, no reorder[2] new server, GD old bundle, reorder[3] new bundle, no reorder[4] [1] reordering is expensive on the server in this case, skip it [2] client can choose to do its own redelta here [3] reordering is needed because otherwise the pull does a lot of extra work on the server [4] reordering isn't needed because client can get deltabase in bundle format Currently, the default is to reorder on GD-servers, and not otherwise. A new setting, bundle.reorder, has been added to override the default reordering behavior. It can be set to either 'auto' (the default), or any true or false value as a standard boolean setting, to either force the reordering on or off regardless of generaldelta. Some timing data from a relatively branch test repository follows. All bundling is done with --all --type none options. Non-generaldelta, non-shrunk repo: ----------------------------------- Size: 276M Without reorder (default): Bundle time: 14.4 seconds Bundle size: 939M With reorder: Bundle time: 1 minute, 29.3 seconds Bundle size: 381M Generaldelta, non-shrunk repo: ----------------------------------- Size: 87M Without reorder: Bundle time: 2 minutes, 1.4 seconds Bundle size: 939M With reorder (default): Bundle time: 25.5 seconds Bundle size: 381M
author Sune Foldager <cryo@cyanite.org>
date Wed, 18 May 2011 23:26:26 +0200
parents 85c82ebc96a3
children ec2aae8b375d
comparison
equal deleted inserted replaced
14364:a3b9f1bddab1 14365:a8e3931e3fb5
12 """ 12 """
13 13
14 # import stuff from node for others to import from revlog 14 # import stuff from node for others to import from revlog
15 from node import bin, hex, nullid, nullrev, short #@UnusedImport 15 from node import bin, hex, nullid, nullrev, short #@UnusedImport
16 from i18n import _ 16 from i18n import _
17 import ancestor, mdiff, parsers, error, util 17 import ancestor, mdiff, parsers, error, util, dagutil
18 import struct, zlib, errno 18 import struct, zlib, errno
19 19
20 _pack = struct.pack 20 _pack = struct.pack
21 _unpack = struct.unpack 21 _unpack = struct.unpack
22 _compress = zlib.compress 22 _compress = zlib.compress
1084 if type(text) == str: # only accept immutable objects 1084 if type(text) == str: # only accept immutable objects
1085 self._cache = (node, curr, text) 1085 self._cache = (node, curr, text)
1086 self._basecache = (curr, chainbase) 1086 self._basecache = (curr, chainbase)
1087 return node 1087 return node
1088 1088
1089 def group(self, nodelist, bundler): 1089 def group(self, nodelist, bundler, reorder=None):
1090 """Calculate a delta group, yielding a sequence of changegroup chunks 1090 """Calculate a delta group, yielding a sequence of changegroup chunks
1091 (strings). 1091 (strings).
1092 1092
1093 Given a list of changeset revs, return a set of deltas and 1093 Given a list of changeset revs, return a set of deltas and
1094 metadata corresponding to nodes. The first delta is 1094 metadata corresponding to nodes. The first delta is
1096 guaranteed to have this parent as it has all history before 1096 guaranteed to have this parent as it has all history before
1097 these changesets. In the case firstparent is nullrev the 1097 these changesets. In the case firstparent is nullrev the
1098 changegroup starts with a full revision. 1098 changegroup starts with a full revision.
1099 """ 1099 """
1100 1100
1101 revs = sorted([self.rev(n) for n in nodelist]) 1101 # for generaldelta revlogs, we linearize the revs; this will both be
1102 # much quicker and generate a much smaller bundle
1103 if (self._generaldelta and reorder is not False) or reorder:
1104 dag = dagutil.revlogdag(self)
1105 revs = set(self.rev(n) for n in nodelist)
1106 revs = dag.linearize(revs)
1107 else:
1108 revs = sorted([self.rev(n) for n in nodelist])
1102 1109
1103 # if we don't have any revisions touched by these changesets, bail 1110 # if we don't have any revisions touched by these changesets, bail
1104 if not revs: 1111 if not revs:
1105 yield bundler.close() 1112 yield bundler.close()
1106 return 1113 return