mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
OS X: try cheap ascii .lower() in normcase before making full unicode dance
This is similar to what is done in encoding.lower, introduced in e7a5733d533f. This has been seen making 'hg up' and 'hg st' in a 50000+ files repo 13% faster. This might make Mercurial slightly slower for users who mainly use non-ASCII filenames. That is a reasonable trade-off.
This commit is contained in:
parent
e8e2c1e1fe
commit
bba6c5042a
@ -194,6 +194,11 @@ if sys.platform == 'darwin':
|
||||
import fcntl # only needed on darwin, missing on jython
|
||||
|
||||
def normcase(path):
|
||||
try:
|
||||
path.decode('ascii') # throw exception for non-ASCII character
|
||||
return path.lower()
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
try:
|
||||
u = path.decode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
|
Loading…
Reference in New Issue
Block a user