From patchwork Fri Nov 23 14:09:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [08,of,13] perf: run 'setup' function during stub run From: Boris Feld X-Patchwork-Id: 36737 Message-Id: <1ab87863dc79a8e3139c.1542982144@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Fri, 23 Nov 2018 15:09:04 +0100 # HG changeset patch # User Boris Feld # Date 1542926924 -3600 # Thu Nov 22 23:48:44 2018 +0100 # Node ID 1ab87863dc79a8e3139c723e83bef8c1ce107016 # Parent e2599c3fba4223ced20a7a253e67631851cab700 # EXP-Topic perf-branchmap # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1ab87863dc79 perf: run 'setup' function during stub run The benchmarked function might need the content of the setup to be run in order to function properly. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -276,6 +276,8 @@ def gettimer(ui, opts=None): return functools.partial(_timer, fm, displayall=displayall), fm def stub_timer(fm, func, setup=None, title=None): + if setup is not None: + setup() func() @contextlib.contextmanager