Time an evaluation

To find the amount of wall-clock time it takes to evaluate an expression, wrap it with AbsoluteTiming:

Compare this with the timing of the analogous evaluation that uses a Do loop:

The results are the same:

However, the Table expression is much faster than the expression using AppendTo. Calculate the ratio of the two computation times:

Notes

Sometimes the results of expensive functions will be cached, thus reducing their measured timing when repeated:
  • An expression with no output or suppressed output will return Null when wrapped with AbsoluteTiming.
Timing reports CPU time used:
RepeatedTiming returns the average timing of repeated evaluations of the same input:
This is roughly equivalent to taking the Mean of a set of values: