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 serhiy.storchaka
Recipients CCLDArjun, serhiy.storchaka
Date 2022-01-28.09:19:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643361559.97.0.0922514301096.issue46500@roundup.psfhosted.org>
In-reply-to
Content
Usually, when you benchmark a non-trivial piece of code, you need also to specify a setup code. If the benchmarked code is large enough to be read from a file, the setup code should be read from a file too.

The common practice is to write the benchmarked code as a function which can be imported and repeatedly executed.

$ python -m timeit -s 'from mybench import test' 'test()'
History
Date User Action Args
2022-01-28 09:19:19serhiy.storchakasetrecipients: + serhiy.storchaka, CCLDArjun
2022-01-28 09:19:19serhiy.storchakasetmessageid: <1643361559.97.0.0922514301096.issue46500@roundup.psfhosted.org>
2022-01-28 09:19:19serhiy.storchakalinkissue46500 messages
2022-01-28 09:19:19serhiy.storchakacreate