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 ncoghlan
Recipients ncoghlan
Date 2009-03-08.06:02:16
SpamBayes Score 5.045142e-05
Marked as misclassified No
Message-id <1236492146.81.0.454674408295.issue5441@psf.upfronthosting.co.za>
In-reply-to
Content
For quick and dirty benchmarking, timeit.main() is one of the handiest
tools out there, but calling it from Python code is a little tedious
since you need to construct a fake list of command line arguments in
order to call it.

What would be nice is a convenience function that accepted appropriate
arguments, with timeit.main being refactored to parse the command line
arguments and then call the new convenience function.

Possible API:

def measure(stmt="pass", setup="pass", timer=default_timer,
            repeat=default_repeat, number=default_number,
            verbosity=0, precision=3)

The new function would cover the latter section of the current main()
function, starting from the line "t = Timer(stmt, setup, timer)".
History
Date User Action Args
2009-03-08 06:02:27ncoghlansetrecipients: + ncoghlan
2009-03-08 06:02:26ncoghlansetmessageid: <1236492146.81.0.454674408295.issue5441@psf.upfronthosting.co.za>
2009-03-08 06:02:21ncoghlanlinkissue5441 messages
2009-03-08 06:02:18ncoghlancreate