Patchwork D1939: ui: Improve performance for multi-component writes

login
register
mail settings
Submitter phabricator
Date Jan. 25, 2018, 7:01 p.m.
Message ID <differential-rev-PHID-DREV-y7na6gxdofuejafo2uxg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27061/
State Superseded
Headers show

Comments

phabricator - Jan. 25, 2018, 7:01 p.m.
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It is more efficient to pass down one large string to the output streams
  than many small ones. For a ``hg diff`` test case, it improves time from
  2m26s to 2m8s.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1939

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -928,8 +928,7 @@ 
         # opencode timeblockedsection because this is a critical path
         starttime = util.timer()
         try:
-            for a in msgs:
-                self.fout.write(a)
+            self.fout.write(''.join(msgs))
         except IOError as err:
             raise error.StdioError(err)
         finally: