From patchwork Fri Feb 10 21:06:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,8,v3] contrib: add a write microbenchmark to perf.py From: Simon Farnsworth X-Patchwork-Id: 18409 Message-Id: <838c119320b457e9dfcc.1486760777@devvm022.lla2.facebook.com> To: Date: Fri, 10 Feb 2017 13:06:17 -0800 # HG changeset patch # User Simon Farnsworth # Date 1486760403 28800 # Fri Feb 10 13:00:03 2017 -0800 # Node ID 838c119320b457e9dfcc45d3d8a50a48d5ea5243 # Parent 25b4512a095b2f3788b255274a15d68dbc10f7b4 contrib: add a write microbenchmark to perf.py I'm adding some performance logging to ui.write - this benchmark lets us confirm that the cost of that logging is acceptably low. At this point, the microbenchmark on Linux over SSH shows: ! wall 0.000003 comb 0.000000 user 0.000000 sys 0.000000 (best of 82813) while on the Mac locally, it shows: ! wall 0.000000 comb 0.000000 user 0.000000 sys 0.000000 (best of 318339) diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1257,6 +1257,16 @@ timer(fn, title=title) fm.end() +@command('perfwrite', formatteropts) +def perfwrite(ui, repo, **opts): + """microbenchmark ui.write + """ + timer, fm = gettimer(ui, opts) + def write(): + ui.write(('Testing write performance\n')) + timer(write) + fm.end() + def uisetup(ui): if (util.safehasattr(cmdutil, 'openrevlog') and not util.safehasattr(commands, 'debugrevlogopts')): diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t +++ b/tests/test-contrib-perf.t @@ -109,6 +109,7 @@ perfvolatilesets benchmark the computation of various volatile set perfwalk (no help text available) + perfwrite microbenchmark ui.write (use 'hg help -v perfstatusext' to show built-in aliases and global options) $ hg perfaddremove