hg diff: why is it listing the directories?

Giovanni Bajo rasky at develer.com
Sat Jun 2 16:35:43 UTC 2007


On 6/2/2007 6:33 PM, Matt Mackall wrote:

>> 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.

I'm doing tests against a fresh checkout. Shouldn't that be already true 
for a fresh checkout?
-- 
Giovanni Bajo




More information about the Mercurial mailing list