EchoTiming[expr]
evaluates expr, prints the time in seconds used and returns the result of the evaluation.
EchoTiming[expr,label]
prints the timing, prepending label.
EchoTiming
EchoTiming[expr]
evaluates expr, prints the time in seconds used and returns the result of the evaluation.
EchoTiming[expr,label]
prints the timing, prepending label.
Details and Options
- EchoTiming is a variant of Echo that reports the absolute timing of an evaluation.
- EchoTiming has attribute HoldFirst.
- The following options can be given:
-
Method AbsoluteTiming method to use to time the evaluation - Possible settings for the Method option include:
-
Timing print the CPU time spent in the Wolfram Language kernel AbsoluteTiming print the real wall clock time that has elapsed RepeatedTiming print the average timing of several evaluations - The value of Method should be a function of one argument that returns a list {timing,result}. EchoTiming will print timing and return result.
Examples
open all close allBasic Examples (2)
Print the timing of an intermediate computation:
Length[EchoTiming[{Pause[0.5], Pause[0.3], Pause[0.2]}]]Length[EchoTiming[{Pause[0.5], Pause[0.3], Pause[0.2]}, Method -> Timing]]Print the timing with a label:
expr1;EchoTiming[Total[Range[10 ^ 9]], "total:"];expr2Scope (1)
Options (2)
Method (2)
By default, EchoTiming uses AbsoluteTiming to report timings:
Length[EchoTiming[{Pause[0.5], Pause[0.3], Pause[0.2]}]]Use Timing to report only time spent in the Wolfram Language kernel:
Length[EchoTiming[{Pause[0.5], Pause[0.3], Pause[0.2]}, Method -> Timing]]Define a custom timing function, which must have have a holding attribute like HoldFirst:
SetAttributes[myTiming, HoldFirst];
myTiming[expr_] := AbsoluteTiming[TimeConstrained[expr, 3]]Use it as the timing Method:
EchoTiming[Pause[5];2 + 2, Method -> myTiming]Applications (2)
Time EntityValue calls:
GeoGraphics[EchoTiming@EntityValue[Entity["GeographicRegion", "Africa"], "Polygon"]]Set $Pre to EchoTiming to print the timing of all computations:
$Pre = EchoTimingThe timing gets automatically printed:
Pause[1];2 + 2Unset $Pre:
$Pre=.Properties & Relations (3)
With MethodRepeatedTiming, only the result of the first evaluation is returned:
x = 0;EchoTiming[x++, Method -> RepeatedTiming]EchoTiming can be used to print the timing of intermediate computations without affecting the overall computation:
x = 1;EchoTiming[Pause[x++]];xEcho can also be used to print the timing, but at the cost of doing the computation twice, which may not be desirable:
x = 1;Echo[Unevaluated[Pause[x++]], "timing:", AbsoluteTiming];xEchoTiming is disabled inside QuietEcho:
QuietEcho[EchoTiming[1 + 1]]Related Guides
History
Text
Wolfram Research (2020), EchoTiming, Wolfram Language function, https://reference.wolfram.com/language/ref/EchoTiming.html.
CMS
Wolfram Language. 2020. "EchoTiming." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EchoTiming.html.
APA
Wolfram Language. (2020). EchoTiming. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EchoTiming.html
BibTeX
@misc{reference.wolfram_2026_echotiming, author="Wolfram Research", title="{EchoTiming}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EchoTiming.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_echotiming, organization={Wolfram Research}, title={EchoTiming}, year={2020}, url={https://reference.wolfram.com/language/ref/EchoTiming.html}, note=[Accessed: 13-June-2026]}