[PATCH 1 of 2 in crew-stable] store: sort the results of fncachestore.datafiles()

Adrian Buehlmann adrian at cadifra.com
Thu Aug 16 04:28:25 CDT 2012


On 2012-08-16 01:32, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1345073432 25200
> # Branch stable
> # Node ID 4cbb1137941d8d97a59efdf0acd47419f07969d3
> # Parent  935831597e16b9d6a842b2b01388af56ab334ea8
> store: sort the results of fncachestore.datafiles()
> 
> diff --git a/mercurial/store.py b/mercurial/store.py
> --- a/mercurial/store.py
> +++ b/mercurial/store.py
> @@ -398,7 +398,7 @@
>      def datafiles(self):
>          rewrite = False
>          existing = []
> -        for f in self.fncache:
> +        for f in sorted(self.fncache):
>              ef = self.encode(f)
>              try:
>                  yield f, ef, self.getsize(ef)

Nitpick: It would have been nice if you would have written in the change
description *why* you did this (e.g. "for performance reasons").

(I know, you wrote it to the -devel mailing list, but still..)

I guess this indeed very likely qualifies as fixing an old performance
regression, likely first introduced in October 2008 with the fncache
repo format in 7946503ec76e (basicstore._walk returned the files in
sorted order before that already, thus letting datafiles() returning
them sorted too).


More information about the Mercurial-devel mailing list