WOLFRAM

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 AbsoluteTimingmethod to use to time the evaluation
  • Possible settings for the Method option include:
  • Timingprint the CPU time spent in the Wolfram Language kernel
    AbsoluteTimingprint the real wall clock time that has elapsed
    RepeatedTimingprint 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 allclose all

Basic Examples  (2)Summary of the most common use cases

Print the timing of an intermediate computation:

1.003807`
Out[1]=1
0.122255`
Out[2]=2

Print the timing with a label:

"total:" 1.974824`
Out[1]=1

Scope  (1)Survey of the scope of standard use cases

Time the construction of all 8-letter subsets in the English alphabet:

0.158876`
Out[1]=1

Options  (2)Common values & functionality for each option

Method  (2)

By default, EchoTiming uses AbsoluteTiming to report timings:

1.002822`
Out[1]=1

Use Timing to report only time spent in the Wolfram Language kernel:

0.016015`
Out[2]=2

Define a custom timing function, which must have have a holding attribute like HoldFirst:

Use it as the timing Method:

3.001204`
Out[2]=2

Applications  (2)Sample problems that can be solved with this function

Time EntityValue calls:

7.550329`
Out[1]=1

Set $Pre to EchoTiming to print the timing of all computations:

Out[1]=1

The timing gets automatically printed:

1.000641`
Out[2]=2

Unset $Pre:

0.`

Properties & Relations  (3)Properties of the function, and connections to other functions

With MethodRepeatedTiming, only the result of the first evaluation is returned:

1.4452075958251954`*^-7
Out[1]=1

EchoTiming can be used to print the timing of intermediate computations without affecting the overall computation:

1.000824`
Out[1]=1

Echo can also be used to print the timing, but at the cost of doing the computation twice, which may not be desirable:

Out[2]=2

EchoTiming is disabled inside QuietEcho:

Out[1]=1

Neat Examples  (1)Surprising or curious use cases

Find factorizations of numbers of the form , printing intermediate results and their timings:

0.001037`
0.017554`
0.016168`
0.034751`
3.321073`
"Total:" 3.612442`
Out[1]=1
Wolfram Research (2020), EchoTiming, Wolfram Language function, https://reference.wolfram.com/language/ref/EchoTiming.html.
Wolfram Research (2020), EchoTiming, Wolfram Language function, https://reference.wolfram.com/language/ref/EchoTiming.html.

Text

Wolfram Research (2020), EchoTiming, Wolfram Language function, https://reference.wolfram.com/language/ref/EchoTiming.html.

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.

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

Wolfram Language. (2020). EchoTiming. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EchoTiming.html

BibTeX

@misc{reference.wolfram_2025_echotiming, author="Wolfram Research", title="{EchoTiming}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EchoTiming.html}", note=[Accessed: 21-April-2025 ]}

@misc{reference.wolfram_2025_echotiming, author="Wolfram Research", title="{EchoTiming}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EchoTiming.html}", note=[Accessed: 21-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_echotiming, organization={Wolfram Research}, title={EchoTiming}, year={2020}, url={https://reference.wolfram.com/language/ref/EchoTiming.html}, note=[Accessed: 21-April-2025 ]}

@online{reference.wolfram_2025_echotiming, organization={Wolfram Research}, title={EchoTiming}, year={2020}, url={https://reference.wolfram.com/language/ref/EchoTiming.html}, note=[Accessed: 21-April-2025 ]}