Mercurial > hg
comparison mercurial/revlog.py @ 31756: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 | d22f29abeb42 |
comparison
equal
deleted
inserted
replaced
31755:ec48d57de110 | 31756:9ec03d5af48f |
---|---|
1272 if self._cache: | 1272 if self._cache: |
1273 if self._cache[0] == node: | 1273 if self._cache[0] == node: |
1274 # _cache only stores rawtext | 1274 # _cache only stores rawtext |
1275 if raw: | 1275 if raw: |
1276 return self._cache[2] | 1276 return self._cache[2] |
1277 # duplicated, but good for perf | |
1278 if rev is None: | |
1279 rev = self.rev(node) | |
1280 # no extra flags set, no flag processor runs, text = rawtext | |
1281 if self.flags(rev) == REVIDX_DEFAULT_FLAGS: | |
1282 return self._cache[2] | |
1283 | |
1277 cachedrev = self._cache[1] | 1284 cachedrev = self._cache[1] |
1278 | 1285 |
1279 # look up what we need to read | 1286 # look up what we need to read |
1280 rawtext = None | 1287 rawtext = None |
1281 if rev is None: | 1288 if rev is None: |