[PATCH 03 of 15] revlog: changes for cache

Benoit Boissinot benoit.boissinot at ens-lyon.org
Tue Jul 13 08:09:59 CDT 2010


On Mon, Jul 12, 2010 at 04:19:45PM +0530, Pradeepkumar Gayam wrote:
> # HG changeset patch
> # User Pradeepkumar Gayam <in3xes at gmail.com>
> # Date 1278874963 -19800
> # Branch stable
> # Node ID f25ee334ef0e6af1cbf73fad2a20568c15cf68db
> # Parent  15579a3a578521f9bf3e3ad9db0e462c1ffba9f2
> revlog: changes for cache
> 
> diff -r 15579a3a5785 -r f25ee334ef0e mercurial/revlog.py
> --- a/mercurial/revlog.py	Mon Jul 12 00:26:44 2010 +0530
> +++ b/mercurial/revlog.py	Mon Jul 12 00:32:43 2010 +0530
> @@ -1044,16 +1044,21 @@
>                                (self.flags(rev)))
>  
>          # do we have useful data cached?
> -        if self._cache and self._cache[1] >= base and self._cache[1] < rev:
> -            base = self._cache[1]
> -            text = self._cache[2]
> +        if self._cache:
> +            try:
> +                intersect = chain.index(self._cache[1])

dunno if it's worth optimizing, but there could be a check to see if
it's completely outside the chain first (chain should be monotically
increasing).

That's probably a micro optimization and unless we have data showing
it's important we don't care (although using
http://docs.python.org/library/bisect.html could make it faster easily).

cheers,

Benoit
-- 
:wq


More information about the Mercurial-devel mailing list