This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nomeata
Recipients nomeata
Date 2015-04-20.13:28:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429536484.03.0.469371276206.issue24015@psf.upfronthosting.co.za>
In-reply-to
Content
The docs for the timeit command line interface specify

If -n is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds.

This sounds as if it it first tries 1, then 10, then 100 etc. But the code starts with 10 iterations. So even if the tested code already takes long enough (e.g. because it is a suitable loop itself), timit will by default test 10 loops.

I propose to change that, and replace

        # determine number so that 0.2 <= total time < 2.0
        for i in range(1, 10):
            number = 10**i

with

        # determine number so that 0.2 <= total time < 2.0
        for i in range(0, 10):
            number = 10**i

in Lib/timeit.py.
History
Date User Action Args
2015-04-20 13:28:04nomeatasetrecipients: + nomeata
2015-04-20 13:28:04nomeatasetmessageid: <1429536484.03.0.469371276206.issue24015@psf.upfronthosting.co.za>
2015-04-20 13:28:03nomeatalinkissue24015 messages
2015-04-20 13:28:03nomeatacreate