timer

Syntax

timer{ 
   <statement block>; 
}

or

timer (X){ 
    <statement block>;
}

Arguments

For the second scenario, X is a positive integer indicating the number of times to execute the specified statement block consecutively (not in parallel).

Details

Return the execution time of the specified statements.

Examples

x=rand(10.0, 1000000);

timer x*2;
// output
Time elapsed: 3 ms

timer(10){x*2};
// output
Time elapsed: 35.004 ms