Mathematica 9 is now available

Timing

Usage

Timing[expr] 计算expr,返回一个时间和获得结果的列表。


Notes

Timing 给出以秒计算的CPU时间,用符号Second乘。
Timing 有属性 HoldAll.
Timing[expr;] 给出  timing, Null .
First[Timing[expr;]] /. Second->1 产生对计算expr需要的秒数。
• 仅在向下达到至少$TimeUnit秒的间隔时,Timing准确的。
Timing仅包括在内核中花费的CPU时间。它不包括经MathLink和其他连接的外部进程花费的时间。它也不包括在Mathematica前端花费的时间。
Timing[expr] 仅包括在计算expr时花费的时间,例如不包括在结果的格式化或输出上的时间。
Timing在进程运行时间由操作系统安排的所有操作系统上给出准确的结果。
• 在Mathematica必须明确按顺序产生要运行的其他进程的微软视窗和 MacOS的早期版本中,Timing可能过高估计在Mathematica中使用的时间。
• 参见Mathematica 全书: 2.13.3.
Further Examples

Here is the CPU time needed to compute a large Bernoulli number. Suppressing the display of the calculation with a semicolon makes a Null appear in its place in the output.

In[1]:=  

Out[1]=

Doing the computation again is considerably faster because tables were constructed the first time around.

In[2]:=  

Out[2]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.