Steven D'Aprano wrote: > The timeit module is ideal for measuring small code snippets; I want to > measure large function objects. > > Because the timeit module takes the code snippet argument as a string, it > is quite handy to use from the command line, but it is less convenient for > timing large pieces of code or when working in the interactive > interpreter. E.g. variations on this *don't* work: [snip] > Do others have other suggestions or techniques they use?
Python 2.4.3 (#2, Jun 19 2006, 12:51:44) [GCC 4.0.3 20060212 (prerelease) (Debian 4.0.2-9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def foo(x): ... return x+1 ... >>> import timeit >>> timeit.Timer("foo(1)","from __main__ import foo") 1.1497418880462646 Carl Banks -- http://mail.python.org/mailman/listinfo/python-list