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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Dec 13 19:09:15 EST 2019


martinvonz added inline comments.

INLINE COMMENTS

> dirstate.py:611-620
> +        elif len(changedfiles) < 10:
> +            # Avoid turning allfiles into a set, which can be expensive if it's
> +            # large.
> +            to_lookup = []
> +            to_drop = []
> +            for f in changedfiles:
> +                if f in allfiles:

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.

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