Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

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()'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46500>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to