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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Mon Nov 26 05:38:32 EST 2018


pulkit added a comment.


  In https://phab.mercurial-scm.org/D5296#78834, @yuja wrote:
  
  > > diff --git a/mercurial/store.py b/mercurial/store.py
  > > 
  > >   - a/mercurial/store.py +++ b/mercurial/store.py @@ -461,13 +461,13 @@
  > >     1. 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 https://phab.mercurial-scm.org/rHG9fca5b056c0a2f673aefa64f7ec7488bd9188d9d. I guess the current code
  >  would be faster if the fncache is around ~10MB. Can you benchmark it?
  
  
  Yeah the current code is much faster if fncache is not large.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5296

To: pulkit, #hg-reviewers
Cc: yuja, mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list