LoÃc Grenià on Sun, 03 Jun 2012 11:59:31 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: clock_gettime

2012/6/3 Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
> On Sun, Jun 03, 2012 at 01:19:57AM +0200, LoÃc Grenià wrote:
>> Â ÂHi pari developers,
>> Â Âa patch has just been submitted to allow for a different timing function:
>> Â clock_gettime. The accuracy of timing in libpari is 1ms. Under linux,
>> Â getrusage and times accuracy are limited by kernel HZ constant which means
>> Â that accuracy is 10ms if HZ=100, 4ms if HZ=250 or 1ms if HZ=1000.
>> Â clock_gettime however has the accuracy of the underlying hardware clock,
>> Â but the system call is slightly more costly.
>> Â Â If you need better accuracy (and can spend ~15% more in clock_gettime than
>> Â in getrusage) you can use clock_gettime. Otherwise just stick with the
>> Â default.
> Two comments:
> 2) on paridev at least the penalty is much larger that 15%:
> getrusage:
> ? for(i=1,10^7,gettime())
> ? ##
> Â*** Â last result computed in 808 ms.
> clock_gettime:
> ? for(i=1,10^7,gettime())
> ? ##
> Â*** Â last result computed in 2,262 ms.
> given the overhead of an empty loop is about 360ms, this give 448ms for
> getrusage against 1902ms, so this is four time slower (under GP, in C it should
> be worse).

    Indeed, sorry about that. I don't know how I've timed it.