Mercurial > hg-stable
changeset 31761:9ec03d5af48f
revlog: add a fast path for revision(raw=False)
If cache hit and flags are empty, no flag processor runs and "text" equals
to "rawtext". So we check flags, and return rawtext.
This resolves performance issue introduced by a previous patch.
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 30 Mar 2017 21:21:15 -0700 |
parents | ec48d57de110 |
children | 473f2fcc7629 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Thu Mar 30 18:38:03 2017 -0700 +++ b/mercurial/revlog.py Thu Mar 30 21:21:15 2017 -0700 @@ -1274,6 +1274,13 @@ # _cache only stores rawtext if raw: return self._cache[2] + # duplicated, but good for perf + if rev is None: + rev = self.rev(node) + # no extra flags set, no flag processor runs, text = rawtext + if self.flags(rev) == REVIDX_DEFAULT_FLAGS: + return self._cache[2] + cachedrev = self._cache[1] # look up what we need to read