Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 35929:e49c39ffeac2
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
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Thu, 25 Jan 2018 20:00:58 +0100 |
parents | 4e377c43e80b |
children | 4b1c04082cdc |
comparison
equal
deleted
inserted
replaced
35928:c8e2d6ed1f9e | 35929:e49c39ffeac2 |
---|---|
914 def _write(self, *msgs, **opts): | 914 def _write(self, *msgs, **opts): |
915 self._progclear() | 915 self._progclear() |
916 # opencode timeblockedsection because this is a critical path | 916 # opencode timeblockedsection because this is a critical path |
917 starttime = util.timer() | 917 starttime = util.timer() |
918 try: | 918 try: |
919 for a in msgs: | 919 self.fout.write(''.join(msgs)) |
920 self.fout.write(a) | |
921 except IOError as err: | 920 except IOError as err: |
922 raise error.StdioError(err) | 921 raise error.StdioError(err) |
923 finally: | 922 finally: |
924 self._blockedtimes['stdio_blocked'] += \ | 923 self._blockedtimes['stdio_blocked'] += \ |
925 (util.timer() - starttime) * 1000 | 924 (util.timer() - starttime) * 1000 |