Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • $\begingroup$ WReach, I felt this Q&A about a misleading result of Timing when used to time Total is very relevant. Note the difference between Windows and OSX. Also, you example ParallelTable[(Pause[i*5]; i) // Timing, {i, 1, 2}] // Timing evaluates to {1.10491,{{0.116654,1},{0.268138,2}}} for me on OSX mma 10.3, which seems to be fundamentally different from your result. Considering the specific knowledge that goes into this, would you consider expanding your note "(used carefully)"? $\endgroup$ Commented Nov 8, 2015 at 20:21
  • $\begingroup$ @JacobAkkerboom I have added a new section that makes the difficulty of measuring CPU time more explicit, with a reference to the Q&A you linked. I do not have access to Mathematica on OSX. It may be just coincidence with only two data points, but the times reported are proportional to the Pause duration (at about 2% CPU/real time, a surprisingly large ratio). I wonder if this overhead is real, or if it is just an artifact of measurement and/or threading? $\endgroup$ Commented Nov 9, 2015 at 3:07
  • 1
    $\begingroup$ WReach, thanks for your edit, I like it. I did some more timings and there indeed seems to be 2% overhead, proportional to the Pause duration. I can only guess at the answer of whether there is a real overhead. Note that you can abort a Pause. Maybe the kernel thread does not go to sleep any time a Pause is called, but rather it goes into some kind of waiting loop. I wonder if an abort signal is really an OS level signal, or whether it is a mathlink thing. Maybe Halirutan or Szabolcs know more. $\endgroup$ Commented Nov 9, 2015 at 9:56
  • $\begingroup$ @WReach, is it possible to measure both Timing and AbsoluteTiming for an expression? $\endgroup$ Commented Jul 27, 2017 at 17:40
  • $\begingroup$ @alancalvitti We can write expr // Timing // AbsoluteTiming to get both. The AbsoluteTiming result will include the real time taken by the Timing call, but that will be insignificant in practice. $\endgroup$ Commented Jul 27, 2017 at 18:12