evalTimer
Syntax
evalTimer(funcs, [count=1])
Arguments
funcs is a function or a tuple of functions with no parameters.
count (optional) is a positive number indicating the number of times funcs will be executed. The default value is 1.
Details
Return the execution time of the specified functions in units of milliseconds. If funcs is a tuple of functions, return the amount of time to execute these functions consecutively.
evalTimer:-
the input of
timeris a statement block while the input ofevalTimercan only be functions. To useevalTimerto get execution time of a statement block, we need to rewrite the statement block as a user-defined function. -
timerreturns a message which cannot be assigned to a variable;evalTimerreturns a scalar that can be assigned to a variable.
Examples
x=rand(10.0, 1000000)
evalTimer(dot{x,2},10);
// output: 39.609375
evalTimer(sort{x},10);
// output: 837.542702
evalTimer([dot{x,2},sort{x}],10)
// output: 870.065348
