Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

RepeatedTiming

RepeatedTiming[expr]
evaluates expr repeatedly and returns a list of the average time in seconds used, together with the result obtained.

RepeatedTiming[expr,t]
does repeated evaluation for at least t seconds.

DetailsDetails

  • RepeatedTiming has attribute HoldFirst.
  • RepeatedTiming[expr;] will give {timing,Null}.
  • The value of expr returned by RepeatedTiming comes from the first evaluation of expr made by RepeatedTiming.
  • RepeatedTiming always evaluates expr at least four times. It gives a trimmed mean of the timings obtained, discarding lower and upper quartiles.
  • RepeatedTiming gives a result whose precision is typically between one and three digits, reflecting both variance in timing results and underlying precision of the operating system clock.
  • RepeatedTiming measures "wall clock time" and is subject to the same limitations as AbsoluteTiming.
  • RepeatedTiming[expr] uses a total time that is scaled based on initial measurements of the evaluation time for expr.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Time a simple addition:

In[1]:=
Click for copyable input
Out[1]=

Time a more complex operation:

In[2]:=
Click for copyable input
Out[2]=

Specify that at least one second should be used to time the operation:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2015
(10.1)