 time - Maple Help

time

total CPU time used for the session Calling Sequence time(x) time[real](x) Parameters

 x - (optional) expression real - (optional) : use real to specify real time instead of cpu time Description

 • The time command returns the total CPU time used since the start of the Maple session.  The units are in seconds and the value returned is a floating-point number.
 • The time(x) calling sequence returns the time taken to evaluate the expression x.
 • The time[real] command returns the real time elapsed since kernel startup, in seconds.
 • The time[real](x) calling sequence returns the real time used to evaluate expression x.
 Note that when constructing certain data structures, Maple does some automatic simplifications.  For example, Maple recognizes that the expression 3^2 can be exactly represented in its expanded form (9), and so automatically and immediately does the expansion.  Since this computation is done at simplification time, and because the time() command only records CPU time elapsed during evaluation (not simplification), the expansion does not register as having taken any time.
 • To time particular statements or groups of statements, one method would be the following:
 > st := time():
 > ... statements to be timed ...:
 > time() - st;
 Note the use of a colon to prevent the display of an uninteresting value; it is the value  time() - st  which gives the desired information. • The time command is thread-safe as of Maple 15. Examples

To illustrate the difference between time elapsed including simplification of data structures, consider the following example.

The following records only the time to evaluate the expression after the data structure is already created.

 > $\mathrm{time}\left({3}^{1000000}\right)$
 ${0.}$ (1)

The following is the same computation but it also records the time used to create the data structure.

 > $\mathrm{st}≔\mathrm{time}\left(\right):$${3}^{1000000}:$$\mathrm{time}\left(\right)-\mathrm{st}$
 ${0.013}$ (2)

The following is the same computation as the one above, but records real time used instead of cpu time.

 > $\mathrm{st}≔\mathrm{time}\left[\mathrm{real}\right]\left(\right):$${3}^{1000000}:$$\mathrm{time}\left[\mathrm{real}\right]\left(\right)-\mathrm{st}$
 ${0.013}$ (3)