sshserver: avoid a multi-dot attribute lookup in a hot loop
authorBryan O'Sullivan <bryano@fb.com>
Fri, 14 Sep 2012 12:09:44 -0700
changeset 17563 46db0ec640f3
parent 17562 b42b0729744d
child 17564 6d0efc802856
sshserver: avoid a multi-dot attribute lookup in a hot loop This improves stream_out performance by about 3%.
mercurial/sshserver.py
--- a/mercurial/sshserver.py	Fri Sep 14 12:09:05 2012 -0700
+++ b/mercurial/sshserver.py	Fri Sep 14 12:09:44 2012 -0700
@@ -71,8 +71,9 @@
         self.fout.flush()
 
     def sendstream(self, source):
+        write = self.fout.write
         for chunk in source.gen:
-            self.fout.write(chunk)
+            write(chunk)
         self.fout.flush()
 
     def sendpushresponse(self, rsp):