# HG changeset patch # User Joerg Sonnenberger # Date 2018-01-25 19:00:58 # Node ID e49c39ffeac21206f722ffe82059787aa69a4e74 # Parent c8e2d6ed1f9ea4eee7b28250b5aff22433d538b6 ui: improve performance for multi-component writes 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. Differential Revision: https://phab.mercurial-scm.org/D1939 diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -916,8 +916,7 @@ class ui(object): # 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: