Critics have remarked that those four worthies were truly peerless throughout the ages; yet the present falls short of the pastβthe ancients favored unadorned simplicity, whereas the moderns prefer refined elegance. Styles of substance and ornament rise and fall in succession, shifting with the changing mores of the times; such evolution is simply the natural order of things. The ideal lies in honoring antiquity without clashing with the present, and embracing modernity without succumbing to its flawsβembodying that perfect balance of substance and refinement that defines the true gentleman. There is surely no need to abandon a carved palace in favor of a cave dwelling, or to trade a jade carriage for a primitive cart with solid wooden wheels.
Current path: lib64/python2.7/
β Cloned to:
β¬οΈ Go up: /lib64
οΏ½
zfc @ s d Z d d l Z d d l Z d d l Z y d d l Z Wn e k
rS d Z n Xd g Z d Z d Z d Z
e j d k rοΏ½ e j Z
n e j Z
d Z d οΏ½ Z d
οΏ½ Z d d d οΏ½ οΏ½ YZ d d e
e d
οΏ½ Z d d e
e
e d οΏ½ Z d d d οΏ½ Z e d k re j e οΏ½ οΏ½ n d S( sοΏ½ Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Command line usage:
python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [--] [statement]
Options:
-n/--number N: how many times to execute 'statement' (default: see below)
-r/--repeat N: how many times to repeat the timer (default 3)
-s/--setup S: statement to be executed once initially (default 'pass')
-t/--time: use time.time() (default on Unix)
-c/--clock: use time.clock() (default on Windows)
-v/--verbose: print raw timing results; repeat for more digits precision
-h/--help: print this usage message and exit
--: separate options from statement, use when statement starts with -
statement: statement to be timed (default 'pass')
A multi-line statement may be given by specifying each line as a
separate argument; indented lines are possible by enclosing an
argument in quotes and using leading spaces. Multiple -s options are
treated similarly.
If -n is not given, a suitable number of loops is calculated by trying
successive powers of 10 until the total time is at least 0.2 seconds.
The difference in default timer function is because on Windows,
clock() has microsecond granularity but time()'s granularity is 1/60th
of a second; on Unix, clock() has 1/100th of a second granularity and
time() is much more precise. On either platform, the default timer
functions measure wall clock time, not the CPU time. This means that
other processes running on the same computer may interfere with the
timing. The best thing to do when accurate timing is necessary is to
repeat the timing a few times and use the best time. The -r option is
good for this; the default of 3 repetitions is probably enough in most
cases. On Unix, you can use clock() to measure CPU time.
Note: there is a certain baseline overhead associated with executing a
pass statement. The code here doesn't try to hide it, but you should
be aware of it. The baseline overhead can be measured by invoking the
program without arguments.
The baseline overhead differs between Python versions! Also, to
fairly compare older Python versions to Python 2.3, you may want to
use python -O for the older versions to avoid timing SET_LINENO
instructions.
iοΏ½οΏ½οΏ½οΏ½Nt Timers <timeit-src>i@B i t win32sοΏ½
def inner(_it, _timer%(init)s):
%(setup)s
_t0 = _timer()
for _i in _it:
%(stmt)s
_t1 = _timer()
return _t1 - _t0
c C s | j d d d | οΏ½ S( s* Helper to reindent a multi-line statement.s
t ( t replace( t srct indent( ( s /usr/lib64/python2.7/timeit.pyt reindentZ s c s | οΏ½ f d οΏ½ } | S( s? Create a timer function. Used if the "statement" is a callable.c s9 οΏ½ οΏ½ | οΏ½ } x | D]
} | οΏ½ q W| οΏ½ } | | S( N( ( t _itt _timert _funct _t0t _it _t1( t setup( s /usr/lib64/python2.7/timeit.pyt inner` s
( ( R
t funcR ( ( R
s /usr/lib64/python2.7/timeit.pyt _template_func^ s c B sG e Z d Z d d e d οΏ½ Z d d οΏ½ Z e d οΏ½ Z e e d οΏ½ Z
RS( sI Class for timing execution speed of small code snippets.
The constructor takes a statement to be timed, an additional
statement used for setup, and a timer function. Both statements
default to 'pass'; the timer function is platform-dependent (see
module doc string).
To measure the execution time of the first statement, use the
timeit() method. The repeat() method is a convenience to call
timeit() multiple times and return a list of results.
The statements may contain newlines, as long as they don't contain
multi-line string literals.
t passc sοΏ½ | | _ i οΏ½ e | e οΏ½ r6e | e οΏ½ rX e | e d οΏ½ e | d | e d οΏ½ n e | e d οΏ½ e | d οΏ½ } e | e οΏ½ rοΏ½ e | d οΏ½ } e i | d 6| d 6d d 6} nG e | d οΏ½ rοΏ½ e i | d 6d
d 6d d 6} | οΏ½ d <n e d
οΏ½ οΏ½ | | _ e | e d οΏ½ } | e
οΏ½ οΏ½ UοΏ½ d | _ nοΏ½ e | d οΏ½ rοΏ½d | _ e | e οΏ½ rx| οΏ½ οΏ½ οΏ½ f d οΏ½ } n e | d οΏ½ sοΏ½e d
οΏ½ οΏ½ n e
| | οΏ½ | _ n e d οΏ½ οΏ½ d S( s# Constructor. See class doc string.t execs
i i t stmtR
t t initt __call__s _setup()s , _setup=_setupt _setups&