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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Dec 16 19:01:27 EST 2019


martinvonz added inline comments.

INLINE COMMENTS

> spectral wrote in dirstate.py:611-620
> 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.

Okay, that's at least a measurable difference, so I'm fine with the extra complexity.

> dirstate.py:623
> +            changedfilesset = set(changedfiles)
> +            to_lookup = changedfilesset.intersection(set(allfiles))
> +            to_drop = changedfilesset - to_lookup

We typically use the `&` operator instead of `.intersection()`. I'll change it in flight.

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