comparison mercurial/posix.py @ 22781:70624fda193d

normcase: for darwin, use fast ASCII lower Constructing the foldmap is much faster on OS X now. For a large real-world repo, hg perfdirstatefoldmap: before: wall 0.805278 comb 0.800000 user 0.790000 sys 0.010000 (best of 13) after: wall 0.399708 comb 0.410000 user 0.390000 sys 0.020000 (best of 25) This is a nice boost to 'hg status', especially with the third-party hgwatchman extension enabled (which eliminates stat calls). For the above repo, 'hg status' goes from 1.17 seconds to 0.74.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 03 Oct 2014 18:47:28 -0700
parents 331cbf088c4c
children 77c121da6143
comparison
equal deleted inserted replaced
22780:d8ff1f671aed 22781:70624fda193d
215 >>> normcase('\xb8\xca\xc3\xca\xbe\xc8.JPG') # issue3918 215 >>> normcase('\xb8\xca\xc3\xca\xbe\xc8.JPG') # issue3918
216 '%b8%ca%c3\\xca\\xbe%c8.jpg' 216 '%b8%ca%c3\\xca\\xbe%c8.jpg'
217 ''' 217 '''
218 218
219 try: 219 try:
220 path.decode('ascii') # throw exception for non-ASCII character 220 return encoding.asciilower(path) # exception for non-ASCII
221 return path.lower()
222 except UnicodeDecodeError: 221 except UnicodeDecodeError:
223 pass 222 pass
224 try: 223 try:
225 u = path.decode('utf-8') 224 u = path.decode('utf-8')
226 except UnicodeDecodeError: 225 except UnicodeDecodeError: