Fri, 05 May 2017 08:49:46 -0700 dirstate: optimize walk() by using match.visitdir()
Martin von Zweigbergk <martinvonz@google.com> [Fri, 05 May 2017 08:49:46 -0700] rev 32226
dirstate: optimize walk() by using match.visitdir() We already have the logic for restricting directory walks in match.visitdir() that we use for treemanifests. We should take advantage of it when walking the working copy as well. This speeds up "hg st -I rootfilesin:." on the Firefox repo from 0.587s to 0.305s on warm disk (and much more on cold disk). More time is spent reading the dirstate than walking the working copy after. I tried to find scenarios where calling match.visitdir() would be a noticeable overhead, but I couldn't find any. I encourage the reader to try for themselves, since this is performance-critical code.
Fri, 05 May 2017 08:49:07 -0700 match: optimize visitdir() for patterns matching only root directory
Martin von Zweigbergk <martinvonz@google.com> [Fri, 05 May 2017 08:49:07 -0700] rev 32225
match: optimize visitdir() for patterns matching only root directory Because _rootsanddirs() returns a list of directories to visit recursively and a list of directories to visit non-recursively. For patterns such as 'rootfilesin:foo/bar', we clearly need to visit the directory foo/bar, but we also need to visit its parents. The method therefore uses util.dirs() to find the parent directories of 'foo/bar'. That method does not include the root directory, but since we obviously need to visit the root directory, we always added '.' to the set of directories to visit non-recursively. The visitdir() method had special handling to consider set(['.']) to mean that no includes had been specified and would thus visit all directories. However, when the pattern is 'rootfilesin:.', set(['.']) is actually the real set of directories to visit and the special handling of that set meant that all directories got visited instead of just the root directory. The fix is simple: add '.' to the set of parent directories in _rootsanddirs() and stop treating set(['.']) specially. This makes hg files -r . -I rootfilesin:. in a treemanifest version of the Firefox repo go from 1.5s to 0.26s on warm disk (and a *much* bigger improvement on cold disk). Note that the -I is necessary for no good reason. We just haven't optimized visitdir() for regular (non-include, non-exclude) patterns yet.
Sat, 11 Mar 2017 12:25:56 -0800 rebase: don't update state dict same way for each root
Martin von Zweigbergk <martinvonz@google.com> [Sat, 11 Mar 2017 12:25:56 -0800] rev 32224
rebase: don't update state dict same way for each root The update statement does not depend on anything in the loop, so just move it before the loop and do it once. There are no cases where update would happen 0 times before (and 1 now); the function returns early in all such cases.
Thu, 04 May 2017 21:11:40 -0700 forget: access status fields by name, not index
Martin von Zweigbergk <martinvonz@google.com> [Thu, 04 May 2017 21:11:40 -0700] rev 32223
forget: access status fields by name, not index
(0) -30000 -10000 -3000 -1000 -300 -100 -30 -10 -4 +4 +10 +30 +100 +300 +1000 +3000 +10000 tip