classification
Title: Add the --duplicate option for timeit
Type: enhancement Stage: patch review
Components: Demos and Tools, Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alex, georg.brandl, haypo, haypo, pitrou, r.david.murray, rhettinger, serhiy.storchaka, steven.daprano, tim.peters
Priority: normal Keywords:

Created on 2017-04-16 06:12 by serhiy.storchaka, last changed 2017-04-17 02:47 by gvanrossum.

Pull Requests
URL Status Linked Edit
PR 1161 open serhiy.storchaka, 2017-04-16 06:15
Messages (2)
msg291736 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-16 06:12
One of the most used by me option of the "perf timeit" subcommand is --duplicate. It duplicates statements to reduce the overhead of the loop. This is necessary when measure the time of very fast statements. Proposed patch adds this option for CLI of the timeit module.

Similar feature already was proposed in issue21988, but it automatically duplicated statements if they executed too fast. This patch does this only on explicit request. And it affects only command-line interface. You need to duplicate statements manually when use programming interface.
msg291771 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-04-17 00:47
+1 I've long used this technique when timing fast statements.  See https://code.activestate.com/recipes/577834 for an example.
History
Date User Action Args
2017-04-17 02:47:45gvanrossumsetnosy: - gvanrossum, Guido.van.Rossum
2017-04-17 00:47:21rhettingersetmessages: + msg291771
2017-04-16 12:08:45arigosetnosy: - arigo
2017-04-16 06:15:52serhiy.storchakasetpull_requests: + pull_request1290
2017-04-16 06:12:44serhiy.storchakacreate