Mercurial > hg
comparison tests/f @ 26243:836291420d53
revlog: optionally cache the full text when adding revisions
revlog instances can cache the full text of a single revision. Typically
the most recently read revision is cached.
When adding a delta group via addgroup() and _addrevision(), the
full text isn't always computed: sometimes only the passed in delta is
sufficient for adding a new revision to the revlog.
When writing the changelog from a delta group, the just-added full
text revision is always read immediately after it is written because
the changegroup code needs to extract the set of files from the entry.
In other words, revision() is *always* being called and caching the full
text of the just-added revision is guaranteed to result in a cache hit,
making the cache worthwhile.
This patch adds support to _addrevision() for always building and
caching the full text. This option is currently only active when
processing changelog entries from a changegroup.
While the total number of revision() calls is the same, the location
matters: buildtext() calls into revision() on the base revision when
building the full text of the just-added revision. Since the previous
revision's _addrevision() built the full text and the the previous
revision is likely the base revision, this means that the base
revision's full text is likely cached and can be used to compute the
current full text from just a delta. No extra I/O required.
The end result is the changelog isn't opened and read after adding every
revision from a changegroup.
On my 2013 MacBook Pro running OS X 10.10.5 from an SSD and Python 2.7,
this patch impacted the time taken to apply ~262,000 changesets from a
mozilla-central gzip bundle:
before: ~43s
after: ~32s
~25% reduction in changelog processing times. Not bad.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 12 Sep 2015 16:11:17 -0700 |
parents | 7d0aa6269ece |
children | 6686ae524f94 |
comparison
equal
deleted
inserted
replaced
26242:d708873f1f33 | 26243:836291420d53 |
---|