timeit
Measure time required to run function
Description
t = timeit(
measures the time (in seconds) required to run the function specified by the function handlef
)f
。In order to perform a robust measurement,timeit
calls the specified function multiple times and returns the median of the measurements. If the function runs fast,timeit
might call the function many times.
t = timeit(
callsf
,numOutputs
)f
with the desired number of outputs,numOutputs
。By default,timeit
calls the functionf
with one output (or no outputs, if the function does not return any outputs).
Examples
Input Arguments
Tips
以下操作导致意外输出:
- Using
timeit
betweentic
和toc
- Using
timeit
为了计时一个函数,包括调用tic
和toc
- Using
timeit
recursively
- Using