Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 \4ã@s²dZddlZddlZddlZddlZddddgZdZdZd Zej Z e Z d Z d d „ZGd d„dƒZdde edfdd„Zdde eedfdd„Zdddœdd„Zedkr®ejeƒƒdS)amTool 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] [-p] [-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'). Execution time of this setup statement is NOT timed. -p/--process: use time.process_time() (default is time.perf_counter()) -t/--time: use time.time() (deprecated) -c/--clock: use time.clock() (deprecated) -v/--verbose: print raw timing results; repeat for more digits precision -u/--unit: set the output time unit (usec, msec, or sec) -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. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. 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. Classes: Timer Functions: timeit(string, string) -> float repeat(string, string) -> list default_timer() -> float éNÚTimerÚtimeitÚrepeatÚ default_timerz i@Bézˆ def inner(_it, _timer{init}): {setup} _t0 = _timer() for _i in _it: {stmt} _t1 = _timer() return _t1 - _t0 cCs|jddd|ƒS)z*Helper to reindent a multi-line statement.Ú ú )Úreplace)ÚsrcÚindent©r ú/usr/lib64/python3.6/timeit.pyÚreindentPsrc@sPeZdZdZddedfdd„Zddd„Zefdd „Ze efd d „Z dd d „Z dS)raÈ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). If 'globals' is specified, the code will be executed within that namespace (as opposed to inside timeit's namespace). 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. ÚpassNc Csü||_i}|dkrtƒn|}d}t|tƒrJt|tdƒ|d}t|dƒ}n*t|ƒrl||d<|d7}d}d}ntd ƒ‚t|tƒršt||tdƒt|d ƒ}n&t|ƒr¸||d <|d 7}d }ntdƒ‚t j |||d�} | |_ t| tdƒ} t | ||ƒ|d|_ dS)z#Constructor. See class doc string.NÚÚexecréÚ_setupz, _setup=_setupz_setup()z&setup is neither a string nor callableéZ_stmtz , _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)ÚstmtÚsetupÚinitÚinner)ÚtimerÚ_globalsÚ isinstanceÚstrÚcompileÚdummy_src_namerÚcallableÚ ValueErrorÚtemplateÚformatr rr) ÚselfrrrÚglobalsZlocal_nsZ global_nsrZ stmtprefixr Úcoder r r Ú__init__fs6       zTimer.__init__cCsJddl}ddl}|jdk r:t|jƒd|jjdƒtf|jt<|j|d�dS)aéHelper to print a traceback from the timed code. Typical use: t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except: t.print_exc() The advantage over the standard traceback is that source lines in the compiled template will be displayed. The optional file argument directs where the traceback is sent; it defaults to sys.stderr. rNr)Úfile)Ú linecacheÚ tracebackr ÚlenÚsplitrÚcacheÚ print_exc)r#r'r(r)r r r r-‰s   zTimer.print_excc CsBtjd|ƒ}tjƒ}tjƒz|j||jƒ}Wd|r= 0.2. Calls the timeit method with *number* set to successive powers of ten (10, 100, 1000, ...) up to a maximum of one billion, until the time taken is at least 0.2 second, or the maximum is reached. Returns ``(number, time_taken)``. If *callback* is given and is not None, it will be called after each trial with two arguments: ``callback(number, time_taken)``. éé gš™™™™™É?)r5r)r#Úcallbackr8r3Ú time_takenr r r Ú autorangeÒs   zTimer.autorange)N)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__rr&r-Údefault_numberrÚdefault_repeatrr>r r r r rTs "  rcCst||||ƒj|ƒS)zCConvenience function to create Timer object and call timeit method.)rr)rrrr3r$r r r ræscCst||||ƒj||ƒS)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr3r$r r r rës)Ú _wrap_timerc s^|dkrtjdd…}ddl}y(|j|dddddd d d d d g ƒ\}}Wn2|jk rx}zt|ƒtdƒdSd}~XnXt}dj|ƒpŠd}d}g}t} d} d} ddddœ} d‰�xè|D�]Þ\} }| d9krÒt|ƒ}| d:krä|j |ƒ| d;k�r|| k�rþ|} ntdtj d�dS| dk�rPt j }| d?k�r`t j }| d@k�r€| �rxˆd7‰| d7} | dAkr¸ttd*d+�dSq¸Wdj|ƒ�pªd}ddl}tjjd|jƒ|dk �rÖ||ƒ}t|||ƒ}|dk�r(d}| �r‡fd,d-„}y|j|ƒ\}}Wn|jƒdSy|j| |ƒ}Wn|jƒdSt|ƒ}| �rxtd.d*j‡fd/d0„|Dƒƒƒtd1|d*d+�|d|}| dk �r¨| | }n>d2d0„| jƒDƒ}|jd3d4�x|D]\}} ||k�rÌP�qÌWtd5| ˆ||| fƒt|ƒ}|d|}t|ƒ}||d6k�rZ|d|}ddl}|jd7ˆ||| ftd8dƒdS)Ba“Main program, used when run as a script. The optional 'args' argument specifies the command line to be parsed, defaulting to sys.argv[1:]. The return value is an exit code to be passed to sys.exit(); it may be None to indicate success. When an exception happens during timing, a traceback is printed to stderr and the return value is 1. Exceptions at other times (including the template compilation) are not caught. '_wrap_timer' is an internal interface used for unit testing. If it is not None, it must be a callable that accepts a timer function and returns another timer function (used for unit testing). Nr:rz n:u:s:r:tcpvhznumber=zsetup=zrepeat=ÚtimeÚclockZprocessÚverbosezunit=Úhelpz#use -h/--help for command line helpérrg@�@g€„.A)ÚusecZmsecZsecrú-nú--numberú-sú--setupú-uú--unitz4Unrecognized unit. Please select usec, msec, or sec.)r'ú-rú--repeatú-tú--timeú-cú--clockú-pú --processú-vú --verboseú-hú--helpr)Úendcsd}t|j||ˆd�ƒdS)Nz#{num} loops -> {secs:.{prec}g} secs)ZnumZsecsZprec)Úprintr")r3r=Úmsg)Ú precisionr r r<@szmain..callbackz raw times:csg|]}dˆ|f‘qS)z%.*gr )Ú.0Úx)rar r ú Oszmain..z %d loops,cSsg|]\}}||f‘qSr r )rbZunitÚscaler r r rdUsT)Úreversezbest of %d: %.*g %s per looprztThe test results are likely unreliable. The worst time (%.*g %s) was more than four times slower than the best time.r)rLrM)rNrO)rPrQ)rRrS)rTrU)rVrW)rXrY)rZr[)r\r])ÚsysÚargvÚgetoptÚerrorr_rÚjoinrDÚintr6ÚstderrrFrGZ process_timerBÚosÚpathÚinsertÚcurdirrr>r-rÚminÚitemsÚsortÚmaxÚwarningsÚ warn_explicitÚ UserWarning)ÚargsrEriZoptsÚerrrrr3rrrHZ time_unitZunitsÚoÚarnr9r<Ú_r7ZbestrKreZscalesZworstrvr )rar Úmainðs¼                        r~Ú__main__)N)rBr/rgrFr.Ú__all__rrCrDZ perf_counterrr$rr!rrrrr~r?Úexitr r r r Ú3s*  y