[PATCH 9 of 9 V2] revlog: add a fast path for revision(raw=False)

Yuya Nishihara yuya at tcha.org
Sun Apr 2 08:40:47 UTC 2017


On Fri, 31 Mar 2017 11:08:56 +0100, Ryan McElroy wrote:
> On 3/31/17 5:45 AM, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1490934075 25200
> > #      Thu Mar 30 21:21:15 2017 -0700
> > # Node ID 70c6b2eecf4d580d38404f157ef99da237593a68
> > # Parent  3a4dd24ccf078c47722582f00872a88d33042ac3
> > revlog: add a fast path for revision(raw=False)
> 
> Wow! This series is enormously more clear than it's precursor. The way 
> you refactored the test is superb and clearly shows the progression of 
> the fixes. This is fantastic!

Yeah, queued with delight, thanks.

> > --- a/mercurial/revlog.py
> > +++ b/mercurial/revlog.py
> > @@ -1275,4 +1275,11 @@ class revlog(object):
> >                   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]

Maybe flags can be cached to avoid extra node->rev lookup.


More information about the Mercurial-devel mailing list