changeset 27068:9eeca021a803

ui.write: don't clear progress bar when writing to a buffer ui.write() has 2 modes: buffered and unbuffered. In buffered mode, we capture output before writing it. This is how changeset printing works, for example. Previously, we were potentially clearing the progress bar for every call to ui.write(). In buffered mode, this clearing was useless because the clearing function would be called again before actually writing the buffered data. This patch stops the useless calling of _progclear() unless we are actually writing data. During changeset printing with the default template, this removes ~6 function calls per changeset, making changeset printing slightly faster. before: 23.76s after: 23.35s delta: -0.41s (98.3% of original)
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Nov 2015 17:14:14 -0800
parents 19b52cde2b84
children 4e554a7df1e9
files mercurial/ui.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Sun Nov 22 21:20:08 2015 -0500
+++ b/mercurial/ui.py	Sat Nov 14 17:14:14 2015 -0800
@@ -612,10 +612,10 @@
         "cmdname.type" is recommended. For example, status issues
         a label of "status.modified" for modified files.
         '''
-        self._progclear()
         if self._buffers:
             self._buffers[-1].extend([str(a) for a in args])
         else:
+            self._progclear()
             for a in args:
                 self.fout.write(str(a))