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.
--- 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