Mercurial > hg
comparison mercurial/dirstate.py @ 22782:a1eb21f5caea
dirstate: cache util.normcase while constructing the foldmap
This is a small win on OS X. hg perfdirstatefoldmap:
before: wall 0.399708 comb 0.410000 user 0.390000 sys 0.020000 (best of 25)
after: wall 0.386331 comb 0.390000 user 0.370000 sys 0.020000 (best of 25)
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 03 Oct 2014 18:48:09 -0700 |
parents | 0c7b018d3258 |
children | dfa44e25bb53 |
comparison
equal
deleted
inserted
replaced
22781:70624fda193d | 22782:a1eb21f5caea |
---|---|
82 return self._copymap | 82 return self._copymap |
83 | 83 |
84 @propertycache | 84 @propertycache |
85 def _foldmap(self): | 85 def _foldmap(self): |
86 f = {} | 86 f = {} |
87 normcase = util.normcase | |
87 for name, s in self._map.iteritems(): | 88 for name, s in self._map.iteritems(): |
88 if s[0] != 'r': | 89 if s[0] != 'r': |
89 f[util.normcase(name)] = name | 90 f[normcase(name)] = name |
90 for name in self._dirs: | 91 for name in self._dirs: |
91 f[util.normcase(name)] = name | 92 f[normcase(name)] = name |
92 f['.'] = '.' # prevents useless util.fspath() invocation | 93 f['.'] = '.' # prevents useless util.fspath() invocation |
93 return f | 94 return f |
94 | 95 |
95 @repocache('branch') | 96 @repocache('branch') |
96 def _branch(self): | 97 def _branch(self): |