Commit Graph

20 Commits

Author SHA1 Message Date
Serhiy Storchaka 557b9a52ed
bpo-40670: More reliable validation of statements in timeit.Timer. (GH-22358)
It now accepts "empty" statements (only whitespaces and comments)
and rejects misindentent statements.
2020-09-22 16:16:46 +03:00
Serhiy Storchaka 70d28a184c Remove unused imports. 2016-12-16 20:00:15 +02:00
Serhiy Storchaka d3ff784f2d Issue #28469: timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead
of 1, 10, 100,... for autoranging.
2016-10-23 15:17:05 +03:00
Victor Stinner 62cca920db timeit: add newlines to output for readability
Issue #28240.
2016-10-18 17:55:18 +02:00
Victor Stinner c3e40f8c5b timeit: add nsec (nanosecond) unit for format timings
Issue #28240.
2016-10-18 17:42:48 +02:00
Victor Stinner 61de57f175 timeit: enhance format of raw timings (in verbose mode)
Issue #28240.
2016-10-18 17:56:42 +02:00
Victor Stinner 3d7feb9ac2 timeit: remove --clock and --time options
Issue #28240: timeit: remove -c/--clock and -t/--time command line options
which were deprecated since Python 3.3.
2016-10-18 17:18:21 +02:00
Victor Stinner 1b90115304 timeit: change default repeat to 5, instead of 3
Issue #28240: timeit now repeats the benchmarks 5 times instead of only 3 to
make benchmarks more reliable.
2016-10-18 17:13:22 +02:00
Victor Stinner f8fb82cd25 timeit: start autorange with 1 iteration, not 10
Issue #28240: timeit autorange now uses a single loop iteration if the
benchmark takes less than 10 seconds, instead of 10 iterations.

"python3 -m timeit -s 'import time' 'time.sleep(1)'" now takes 4 seconds
instead of 40 seconds.
2016-10-18 17:06:56 +02:00
Steven D'Aprano 09f4f711b6 Issue6422 add autorange method to timeit.Timer 2016-08-15 01:27:03 +10:00
Serhiy Storchaka ced770da07 Issue #24631: Fixed regression in the timeit modulu with multyline setup. 2015-07-15 22:11:36 +03:00
Serhiy Storchaka 1b560cbf85 Issue #5633: Fixed timeit when the statement is a string and the setup is not.
Refactored timeit.__init__ for unified handling of stmt and setup parameters.
2015-05-30 19:44:55 +03:00
Serhiy Storchaka f28fa66351 Issue #5633: Fixed timeit when the statement is a string and the setup is not. 2015-05-30 19:38:26 +03:00
Zachary Ware 38c707e7e0 Issue #21741: Update 147 test modules to use test discovery.
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux.  The only differences I found were actually tests
that were previously *not* run.
2015-04-13 15:00:43 -05:00
Robert Collins 302dbc6792 Issue #18983: Allow selection of output units in timeit.
This allows manual selection of a specific unit such as usecs rather than the
use of a heuristic. This is intended to aid machine processing of timeit
output.

Patch by Serhiy Storchaka.
2015-03-18 09:54:50 +13:00
Serhiy Storchaka c959b0cd30 Issue #18518: timeit now rejects statements which can't be compiled outside
a function or a loop (e.g. "return" or "break").
2015-01-26 12:09:59 +02:00
Serhiy Storchaka 2bef58577f Issue #18518: timeit now rejects statements which can't be compiled outside
a function or a loop (e.g. "return" or "break").
2015-01-26 12:09:17 +02:00
Antoine Pitrou ef3b9ed0ac Issue #2527: Add a *globals* argument to timeit functions, in order to override the globals namespace in which the timed code is executed.
Patch by Ben Roberts.
2014-08-22 23:13:50 -04:00
Benjamin Peterson a5c4090394 skip if __doc__ is gone 2012-10-12 11:44:19 -04:00
R David Murray a88da67bcb #11578: add unit tests for timeit module.
Patch by Michael Henry.
2011-03-16 17:32:27 -04:00