Mathematica 9 is now available
Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Timing in Mathematica

  • To: mathgroup at
  • Subject: [mg74739] Re: Timing in Mathematica
  • From: "Szabolcs" <szhorvat at>
  • Date: Tue, 3 Apr 2007 00:26:54 -0400 (EDT)
  • References: <euqnqt$8br$>

amitsoni.1984 at =EDrta:
> Hi,
> I am using Timing[.......] to calculate the time taken by an
> expression in Mathematica. But it is not showing values below 0.01
> seconds. For values below 0.01s it just shows 0. Second
> Is it possible to get the value of time lower than 0.01s by somehow
> lowering the least count. I am using Mathematica 5.2 on Windows. I was
> getting lower values of time on Mathematica(5.2) on a Linux computer.
> Thank you,
> Amit

After doing some experimentation, I found that on my system
AbsoluteTiming returns integer multiples of 0.015625 seconds. Timing
returns the same values, but rounded to $TimeValue of 0.001.
(Mathematica 5.2 on WinXP SP2)

But you still shouldn't assume that timings are precise to 0.015625.
For some reason, when I record several timing values with Table, the
first one is always larger then the rest (significantly larger for
short times).

Here are two examples with very short timings:





Other calculations inside Do[] or using Timing instead of
AbsoluteTiming give similar results.

I hope that this will persuade you not try to measure very short
execution times.

  • Prev by Date: Re: Closing All Input Cells at Once- KB shortcuts
  • Next by Date: Re: Solve[] and Eliminate[] choke on simple systems
  • Previous by thread: Re: Timing in Mathematica
  • Next by thread: Re: Timing in Mathematica