D7665: dirstate: when calling rebuild(), avoid some N^2 codepaths

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Dec 13 20:27:31 EST 2019


spectral added inline comments.

INLINE COMMENTS

> martinvonz wrote in dirstate.py:611-620
> How slow? Specifically, how much slower (in percent, or dB, or whatever) is it compared to not converting to a set? I wonder if it's worth the code. `hg debugrebuilddirstate` should be a very rare operation.

With 1 file in changedfiles and 200k files in allfiles, approximately 15x slower. That said, it's a little over 1.5ms in the old version, so in absolute terms this isn't a big difference until you get really huge repos.  I haven't really investigated when changedfiles is not None, if it's just for `hg debugrebuilddirstate --minimal`, I agree this isn't worth the complexity, but it looks like mq, strip, and absorb all call rebuild in some cases, and strip and absorb will pass in a list of files.  Unsure if that changes things materially, though.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7665/new/

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

To: spectral, #hg-reviewers
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list