Commit Graph

17 Commits

Author SHA1 Message Date
Georg Brandl d9bef35e3c Patch #1533909: the timeit module now accepts callables in addition to
strings for the code to time and the setup code. Also added two
convenience functions for instantiating a Timer and calling its methods.
2007-03-13 19:32:21 +00:00
Raymond Hettinger 816ed1b0bd SF patch #868736: Disable GC for timeit
Make timings more consistent by temporarily disabling GC.
2004-01-04 03:47:51 +00:00
Guido van Rossum 571720811b Show microseconds, milliseconds or seconds, whichever is most natural,
rather than showing weird numbers like 8.4e+03 usec.
2003-10-20 23:38:28 +00:00
Martin v. Löwis 7bdc484c97 Patch #808362: Fix typos. 2003-09-20 11:09:28 +00:00
Neal Norwitz c556722f09 remove unused import math 2003-06-29 04:18:15 +00:00
Raymond Hettinger 22952a3efc SF bug 735293: Command line timeit.py sets sys.path badly
Paul Moore's patch to have timeit.py check the current directory for
imports (instead of the directory for Lib/timeit.py).
2003-05-20 04:59:56 +00:00
Skip Montanaro cfd55501bb add a #! line for unix weenies 2003-04-08 19:49:40 +00:00
Skip Montanaro fb2a6ccfc4 correct a couple docstring nits 2003-04-08 19:40:19 +00:00
Guido van Rossum dd42edcc9d Rename variables _seq to _it and seq to it, to emphasize that this is
an iterator (which can only be used once!).
2003-03-21 14:54:19 +00:00
Guido van Rossum 0070f007f4 Change the default number of repetitions to 3, both in the Timer class
(from 10) and in main() (from 1).

Add a -v option that shows the raw times.  Repeating it cranks up the
display precision.

Always use the "best of N" form of output.
2003-03-15 12:25:00 +00:00
Guido van Rossum 538f1d842c Implement some recommendations from Raymond H:
- Make all local variables in the template start with an underscore,
  to prevent name conflicts with the timed code.

- Added a method to print a traceback that shows source lines from the
  expanded template.

- Use that method in main().
2003-03-14 17:21:00 +00:00
Guido van Rossum 6e31aad983 Broke down and made it work for Python 2.0 and up. (Older versions
would have required refraining from using string methods -- too
painful.)

Changed the -s option so that multiple -s options are cumulative.
2003-03-07 01:33:18 +00:00
Guido van Rossum 5573541b6f Add a note explaining why you shouldn't try to compute mean and
standard deviation.  Also add an XXX comment wondering if we should
refrain from using itertools.repeat().
2003-03-06 16:11:17 +00:00
Guido van Rossum e05dcce686 Simpler way to write reindent(), suggested by Raymond H. 2003-03-06 13:09:09 +00:00
Guido van Rossum e8577b7298 Add notes about baseline overhead, and about different Python
versions.  Add -h/--help option to print doc string.
2003-03-06 03:02:10 +00:00
Guido van Rossum b7ab6004b1 Added more documentation. 2003-03-06 02:32:19 +00:00
Guido van Rossum b3f09d4331 A flexible utility to time the execution speed of a code snippet.
Usable from the command line or from a program.
2003-03-05 23:31:58 +00:00