store: reduce string concatenation when joining
This improves stream_out performance by a couple of percent.
--- 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