Mercurial > hg
changeset 24523:a4b81dbe73c1
dirstate._walkexplicit: don't bother normalizing '.'
The overwhelmingly common case is running commands like 'hg diff' with no
arguments. Therefore the only file that'll be listed is the root directory.
Normalizing that's just a waste of time.
This means that for a plain 'hg diff' we'll never need to construct the
foldmap, saving us a significant chunk of time.
On case-insensitive HFS+ on OS X, for a large repository with over 200,000
files, this brings down 'hg diff' from 2.97 seconds to 2.36.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 29 Mar 2015 18:28:48 -0700 |
parents | 18085e46caa9 |
children | 63b6031384fc |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Sun Mar 29 23:28:30 2015 -0700 +++ b/mercurial/dirstate.py Sun Mar 29 18:28:48 2015 -0700 @@ -634,7 +634,9 @@ alldirs = None for ff in files: - if normalize: + # constructing the foldmap is expensive, so don't do it for the + # common case where files is ['.'] + if normalize and ff != '.': nf = normalize(ff, False, True) else: nf = ff