Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 34823:7891d243d821
revlog: ignore empty trailing chunks when reading segments
When a merge commit creates an empty diff in the revlog, its offset may still
be quite far from the end of the previous chunk.
Skipping these empty chunks may reduce read size significantly.
In most cases, there is no gain, and in some cases, little gain.
On my clone of pypy, `hg manifest` reads 65% less bytes (96140 i/o 275943) for
revision 4260 by ignoring the only empty trailing diff.
For revision 2229, 35% (34557 i/o 53435)
Sadly, this is difficult to reproduce, as hg clone can make its own different
structure every time.
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Mon, 09 Oct 2017 15:13:41 +0200 |
parents | 3c9691728237 |
children | e2ad93bcc084 |
comparison
equal
deleted
inserted
replaced
34822:c1e7ce11db9b | 34823:7891d243d821 |
---|---|
1325 buffer = util.buffer | 1325 buffer = util.buffer |
1326 | 1326 |
1327 l = [] | 1327 l = [] |
1328 ladd = l.append | 1328 ladd = l.append |
1329 | 1329 |
1330 firstrev = revs[0] | |
1331 # Skip trailing revisions with empty diff | |
1332 for lastrev in revs[::-1]: | |
1333 if length(lastrev) != 0: | |
1334 break | |
1335 | |
1330 try: | 1336 try: |
1331 offset, data = self._getsegmentforrevs(revs[0], revs[-1], df=df) | 1337 offset, data = self._getsegmentforrevs(firstrev, lastrev, df=df) |
1332 except OverflowError: | 1338 except OverflowError: |
1333 # issue4215 - we can't cache a run of chunks greater than | 1339 # issue4215 - we can't cache a run of chunks greater than |
1334 # 2G on Windows | 1340 # 2G on Windows |
1335 return [self._chunk(rev, df=df) for rev in revs] | 1341 return [self._chunk(rev, df=df) for rev in revs] |
1336 | 1342 |