perftemplating: drop usage of buffer
authorBoris Feld <boris.feld@octobus.net>
Thu, 31 May 2018 18:43:15 +0200
changeset 38255 71d59b487d0c
parent 38254 6b91815fcdce
child 38256 b8f75bc9f623
perftemplating: drop usage of buffer The buffer can consume a lot of memory and change various internal behaviors. Writing to dev/null seems more appropriate when it comes to benchmark.
contrib/perf.py
--- a/contrib/perf.py	Thu May 31 17:31:46 2018 +0200
+++ b/contrib/perf.py	Thu May 31 18:43:15 2018 +0200
@@ -899,15 +899,17 @@
 
 @command('perftemplating', formatteropts)
 def perftemplating(ui, repo, *revs, **opts):
+    nullui = ui.copy()
+    nullui.fout = open(os.devnull, 'wb')
+    nullui.disablepager()
+
     def format():
-        commands.log(ui, repo, rev=revs, date='', user='',
+        commands.log(nullui, repo, rev=revs, date='', user='',
                      template='{date|shortdate} [{rev}:{node|short}]'
                               ' {author|person}: {desc|firstline}\n')
 
     timer, fm = gettimer(ui, opts)
-    ui.pushbuffer()
     timer(format)
-    ui.popbuffer()
     fm.end()
 
 @command('perfcca', formatteropts)