changeset 17562:b42b0729744d

store: reduce string concatenation when joining This improves stream_out performance by a couple of percent.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 14 Sep 2012 12:09:05 -0700
parents 4647aa33ad81
children 46db0ec640f3
files mercurial/store.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Fri Sep 14 12:08:55 2012 -0700
+++ b/mercurial/store.py	Fri Sep 14 12:09:05 2012 -0700
@@ -390,6 +390,7 @@
     def __init__(self, path, openertype, encode):
         self.encode = encode
         self.path = path + '/store'
+        self.pathsep = self.path + '/'
         self.createmode = _calcmode(self.path)
         op = openertype(self.path)
         op.createmode = self.createmode
@@ -398,10 +399,10 @@
         self.opener = _fncacheopener(op, fnc, encode)
 
     def join(self, f):
-        return self.path + '/' + self.encode(f)
+        return self.pathsep + self.encode(f)
 
     def getsize(self, path):
-        return os.stat(self.path + '/' + path).st_size
+        return os.stat(self.pathsep + path).st_size
 
     def datafiles(self):
         rewrite = False