timing

Timer and result helpers from IPython/core/magics/execution.py.

TimeitResult

def TimeitResult(
    loops, repeat, best, worst, all_runs, compile_time, precision
):

Object returned by the timeit magic with info about the run.

Contains the following attributes:

loops: int number of loops done per measurement

repeat: int number of times the measurement was repeated

best: float best execution time / number

all_runs : list[float] execution time of each run (in s)

compile_time: float time of statement compilation (s)

TimeitResult.average

def average():

TimeitResult.stdev

def stdev():

TimeitTemplateFiller

def TimeitTemplateFiller(
    ast_setup, ast_stmt
):

Insert the setup and timed statements into the %timeit template.

TimeitTemplateFiller.visit_FunctionDef

def visit_FunctionDef(
    node
):

Fill in the setup statement

TimeitTemplateFiller.visit_For

def visit_For(
    node
):

Fill in the statement to be timed

clock2

def clock2():

clock

def clock():