windows: use 'str.replace()' instead of combination of split() and join()
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sun, 05 Feb 2012 22:58:31 +0900
changeset 16076 e7701459fb42
parent 16075 d2e8e79a6361
child 16087 838907058cfd
windows: use 'str.replace()' instead of combination of split() and join() 'str.replace()' is twice (or more) as fast as combination of split() and join(). combination of split() and join() in current 'util.pconvert()' implementation comes only from historical reason when win32mbcs extension was introduced.
mercurial/windows.py
--- a/mercurial/windows.py	Mon Feb 06 12:16:29 2012 +0900
+++ b/mercurial/windows.py	Sun Feb 05 22:58:31 2012 +0900
@@ -123,7 +123,7 @@
         msvcrt.setmode(fno(), os.O_BINARY)
 
 def pconvert(path):
-    return '/'.join(path.split(os.sep))
+    return path.replace(os.sep, '/')
 
 def localpath(path):
     return path.replace('/', '\\')