src/pylib/Lib/timeit

Source   Edit  

timeit

Templates

template timeit(number = 1000000): float
Source   Edit  
template timeit(repetitions: int; statements: untyped)

EXT. unstable.

returns nothing but send output to stdout.

output shows more information than Pythons.

Example:

var i = 0
timeit(10):
  i.inc
assert i == 10
Source   Edit  
template timeit(stmt; number = 1000000): float

Example:

echo timeit("discard")
Source   Edit  
template timeit(stmt; setup; number = 1000000): float

timeit(stmt, setup, number=1000000) with globals is globals()

stmt, setup are Callable or str literal

Hint: this is equal to python's timeit with arg: globals=globals()
Source   Edit