hg diff: why is it listing the directories?

Matt Mackall mpm at selenic.com
Sat Jun 2 16:33:37 UTC 2007


On Sat, Jun 02, 2007 at 06:15:21PM +0200, Giovanni Bajo wrote:
> Hello,
> 
> I noticed that hg diff over a large repository (the GCC repository) is 
> much slower than svn diff or git-diff. Through strace, I saw that it's 
> listing the contents of all directories in the checkout (os.listdir) and 
> lsprof pointed me the culrpit:
> 
>     CallCount     Total(s)    Inline(s) module:lineno(function)
>         52577      3.4858      0.7476   mercurial.dirstate:397(findfiles)
>        +55834      0.4716      0.4716   +<posix.lstat>
>       +114927      0.6646      0.4654   +posixpath:56(join)
>        +59092      0.8660      0.1521   +mercurial.dirstate:385(imatch)
>        +52576      0.2499      0.1177 
> +mercurial.dirstate:340(supported_type)
>         +3259      0.1085      0.1085   +<posix.listdir>
>         55835      0.4716      0.4716   <posix.lstat>
> 
> Now, why is necessary the list the contents of the directories, for hg 
> diff? Doesn't hg have all the required metadata to know which files to 
> stat without listing anything?

Known bug.

Workaround: make sure all files that aren't part of your project are
properly ignored.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list