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

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Thu Nov 22 08:32:18 EST 2018


yuja added a comment.


  > 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?

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