timeThis – display code chunk timings

timeThis(count, code) runs a chunk of code several times, and output timing estimates about it.

→ Examples

Call:

Example 1:

prog::timeThese can be used to benchmark several pieces of code at once:

prog::timeThese(10000, ["plus"=1+1, "mult" = 100*898]):

plus: CPU: 0.0044 ms/call Wallclock: 0.0044 ms/call

mult: CPU: 0.0049 ms/call Wallclock: 0.0049 ms/call

 

This function is fragile, and will yield strange results if called in nontrivial contexts:

stuffToBenchmark := ["plus"=1+1, "mult" = 100*898]:

prog::timeThese(10000, stuffToBenchmark):

Error: Illegal argument [_concat];

during evaluation of 'prog::timeThese'

 

Changes in MuPAD 4.0

New Function.