# HG changeset patch # User timeless # Date 1449250890 0 # Node ID a6fd79495770ad12f3850eca99862f423a9d996a # Parent 57bd9c5431a553b4bce603b5abeb0c911e3abdb3 perf: offer perf.stub to only run one loop diff -r 57bd9c5431a5 -r a6fd79495770 contrib/perf.py --- a/contrib/perf.py Fri Dec 04 17:41:02 2015 +0000 +++ b/contrib/perf.py Fri Dec 04 17:41:30 2015 +0000 @@ -29,8 +29,15 @@ ui.fout = ui.ferr # get a formatter fm = ui.formatter('perf', opts) + # stub function, runs code only once instead of in a loop + # experimental config: perf.stub + if ui.configbool("perf", "stub"): + return functools.partial(stub_timer, fm), fm return functools.partial(_timer, fm), fm +def stub_timer(fm, func, title=None): + func() + def _timer(fm, func, title=None): results = [] begin = time.time()