Mercurial > hg
changeset 24683:4eaea0ed8dc1
manifest.walk: special-case match.always() for speed
This cuts down the run time of
hg files -r . > /dev/null
from ~0.850s to ~0.780s on the Firefox repo. Note that
manifest.matches() already has the corresponding optimization.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 07 Apr 2015 21:08:23 -0700 |
parents | aef3d1469773 |
children | ff7badaf3158 |
files | mercurial/manifest.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/manifest.py Tue Apr 07 22:36:17 2015 -0700 +++ b/mercurial/manifest.py Tue Apr 07 21:08:23 2015 -0700 @@ -222,6 +222,11 @@ It also reports nonexistent files by marking them bad with match.bad(). ''' + if match.always(): + for f in iter(self): + yield f + return + fset = set(match.files()) # avoid the entire walk if we're only looking for specific files @@ -607,6 +612,11 @@ It also reports nonexistent files by marking them bad with match.bad(). ''' + if match.always(): + for f in iter(self): + yield f + return + fset = set(match.files()) for fn in self._walk(match):