D5296: store: don't read the whole fncache in memory

Yuya Nishihara yuya at tcha.org
Thu Nov 22 08:27:12 EST 2018


> diff --git a/mercurial/store.py b/mercurial/store.py
> --- a/mercurial/store.py
> +++ b/mercurial/store.py
> @@ -461,13 +461,13 @@
>              # skip nonexistent file
>              self.entries = set()
>              return
> -        self.entries = set(decodedir(fp.read()).splitlines())
> -        if '' in self.entries:
> -            fp.seek(0)
> -            for n, line in enumerate(util.iterfile(fp)):
> -                if not line.rstrip('\n'):
> -                    t = _('invalid entry in fncache, line %d') % (n + 1)
> -                    raise error.Abort(t)
> +        self.entries = set()
> +        for n, line in enumerate(util.iterfile(fp)):
> +            entry = line.rstrip('\n')
> +            if not entry:
> +                t = _('invalid entry in fncache, line %d') % (n + 1)
> +                raise error.Abort(t)
> +            self.entries.add(decodedir(entry))

This goes the opposite direction to 9fca5b056c0a. I guess the current code
would be faster if the fncache is around ~10MB. Can you benchmark it?


More information about the Mercurial-devel mailing list