[PATCH] issue 1286

Petr Kodl petrkodl at gmail.com
Thu Sep 4 18:10:12 CDT 2008


Well, since the _foldmap is created lazily on first access and it has 
been accessed directly it makes sure that on non folding OS the foldmap 
stays empty and the
path is just piped through as is.

So for non folding OS the cost is about the same as before ({}.get() vs 
lambda x:x).

I agree it is cleaner to have the normpath() call in place - but in that 
case it needs some way of signaling that the fspath should not be called 
on _foldmap miss.

pk


Adrian Buehlmann wrote:
> Sure. But how is that situation improved by inserting
>
> if self._checkcase:
>
> in the part of the patch I was referring to?
>
> I don't see a response to what I wrote.
>
> On 04.09.2008 21:59, Petr Kodl wrote:
>   
>> it is actually worse than that - since the .hgignore match is done after
>> normalize call it makes the regular hg st / hg diff on tree that already has
>> ignored .obj and other build produced files unreasonably slow
>>
>> 30-45s on subset of my regular work tree
>>
>> pk
>>
>> On Thu, Sep 4, 2008 at 3:38 PM, Petr Kodl <petrkodl at gmail.com> wrote:
>>
>>     
>>> the reason for slow normalize for new files is simple
>>> the foldmap is empty so the normalize always calls util.fspath - for every
>>> one of the new files - which causes 30s hg stat on my regular tree - not
>>> very pleasant
>>>
>>> if the foldmap is not empty than it is just the python function call that's
>>> slow I guess - the speedup in that case is only about 2x which
>>>
>>> btw - this behavior is not present in released 1.0.2 - the pathological
>>> slow checks for new files do not happen there - it is only on hg-crew
>>>
>>> pk
>>>
>>>
>>> On Thu, Sep 4, 2008 at 2:48 PM, Adrian Buehlmann <adrian at cadifra.com>wrote:
>>>
>>>       
>>>> On 04.09.2008 20:06, Petr Kodl wrote:
>>>>         
>>>>> # HG changeset patch
>>>>> # User Petr Kodl <petrkodl at gmail.com>
>>>>> # Date 1220551484 14400
>>>>> # Node ID 0a891c8181c57954a83751022cbab830a65beab0
>>>>> # Parent  6c4a08270222569ba906f4f1c7860783eec19225
>>>>> issue 1286
>>>>>
>>>>> diff -r 6c4a08270222 -r 0a891c8181c5 mercurial/dirstate.py
>>>>> --- a/mercurial/dirstate.py   Wed Sep 03 19:03:57 2008 +0200
>>>>> +++ b/mercurial/dirstate.py   Thu Sep 04 14:04:44 2008 -0400
>>>>> @@ -42,10 +42,11 @@
>>>>>              return self._copymap
>>>>>          elif name == '_foldmap':
>>>>>              _foldmap = {}
>>>>> -            for name in self._map:
>>>>> -                norm = os.path.normcase(os.path.normpath(name))
>>>>> -                _foldmap[norm] = name
>>>>> -            self._foldmap = _foldmap
>>>>> +            if self._checkcase:
>>>>> +                for name in self._map:
>>>>> +                    norm = os.path.normcase(os.path.normpath(name))
>>>>> +                    _foldmap[norm] = name
>>>>> +                self._foldmap = _foldmap
>>>>>              return self._foldmap
>>>>>          elif name == '_branch':
>>>>>              try:
>>>>>           
>>>> Scratching my head...
>>>>
>>>> why would this have any effect (besides adding confusion
>>>> for the code reader)?
>>>>
>>>> _foldmap is only accessed in _normalize, which is only
>>>> aliased to "normalize" if _checkcase is True (quoting line 93):
>>>>
>>>> '''
>>>>        elif name == 'normalize':
>>>>            if self._checkcase:
>>>>                self.normalize = self._normalize
>>>>            else:
>>>>                self.normalize = lambda x: x
>>>>            return self.normalize
>>>> '''
>>>>
>>>> In short, if we access _foldmap, _checkcase is always true.
>>>>
>>>> Or what did I miss here?
>>>>
>>>>
>>>>
>>>>         
>
>   



More information about the Mercurial-devel mailing list