Hello colleague,
On Monday, June 2, 2014 7:01:25 AM UTC+2, Jameson wrote:
>
> Unless you have custom-compiled a near-realtime (or realtime) linux
> kernel, timing anything less than a few seconds (in aggregate) is unlikely
> to give you a meaningful result. Although, even if you have a RT kernel,
> the hardware may not give accurate answers either (typically, it requires
> HPET for microsecond accuracy, or more specialized features for better
> timing).
>
> All that to say, the @time macro uses the system high performance clock,
> and can return very small (although meaningless) numbers:
>
> julia> @time ()
> elapsed time: 1.171e-6 seconds (48 bytes allocated)
>
> Therefore, for benchmarks, you should execute your code in a loop enough
> times that the measurement error (of the hardware and OS) is not too
> significant.
>
I want to thank you for that posting. I've seen recently too many examples
of people trying to compare runtimes in the order of sub-ms, on timing a
single call to a function.