Re: Timing in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg74758] Re: Timing in Mathematica
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Wed, 4 Apr 2007 04:02:51 -0400 (EDT)
- References: <euqnqt$8br$1@smc.vnet.net>
amitsoni.1984 at gmail.com wrote: > 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 > > It never makes sense to time a computer task that takes such a short time because there are all sorts of one-off delays - such as paging information into memory - that can distort the result. If you want to time f[] (say) I would time: f[];f[];f[];f[];f[];f[];f[];f[];f[];f[] and maybe place a loop round this as well to ensure you obtain a total time of at least 10 seconds, dividing the result by the total number of calls to f[]. Bear in mind that the CompoundExpression (;) will take some time, and that Mathematica can cache results in some situations. David Bailey http://www.dbaileyconsultancy.co.uk