# HG changeset patch # User Gregory Szorc # Date 1447550054 28800 # Node ID 9eeca021a80337e04734c608241e85557c0b1ecf # Parent 19b52cde2b84ae6538798127859a66d8de1accd7 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) diff -r 19b52cde2b84 -r 9eeca021a803 mercurial/ui.py --- 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))