[PATCH] manifest: cache parsed fulltext during find

Augie Fackler raf at durin42.com
Mon Mar 11 19:25:07 CDT 2013


On Mar 11, 2013, at 4:17 PM, Bryan O'Sullivan <bos at serpentine.com> wrote:

> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1363036671 25200
> # Node ID 58ab71dcf9fbc1326267811deb13074e595e9667
> # Parent  15e77967d1b3bb5eb9dfb6e7bfe94691d280af74
> manifest: cache parsed fulltext during find
> 
> We were looking up the manifest cache during find, but if it had somehow
> not been primed prior to a call, we were *not* adding the looked-up
> entry to it.

Ouch. Fix looks obviously correct, I'd say ship it.

> 
> This led to a huge slowdown in "hg grep", where we would reconstruct a
> manifest entry from scratch for every single file in every revision we
> were visiting.
> 
> For a manifest containing 150,000 entries with 6,000 changes in one
> revision, this change improves "hg grep" performance from 650 seconds
> to 2. It seems likely to me that other commands could be affected, too,
> but I haven't really looked at which.
> 
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -107,6 +107,7 @@ class manifest(revlog.revlog):
>             mapping = self._mancache[node][0]
>             return mapping.get(f), mapping.flags(f)
>         text = self.revision(node)
> +        self._mancache[node] = self.parse(text), array.array('c', text)
>         start, end = self._search(text, f)
>         if start == end:
>             return None, None
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list