Charles Greathouse on Sun, 30 Sep 2012 22:48:45 +0200

 Re: timing in GP

```I think that some reentrant solution is needed (in GP; of course it's
already possible in PARI). I don't have any particular thoughts on the
merits of the proposed solutions.

Charles Greathouse
Analyst/Programmer
Case Western Reserve University

On Sun, Sep 30, 2012 at 4:46 PM, Karim Belabas
<Karim.Belabas@math.u-bordeaux1.fr> wrote:
> * Loïc Grenié [2012-09-30 22:18]:
>> 2012/9/30 Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
>> > 2) the gettime interface:
>> > The problem is that it is not reentrant.
>> > Let say you write functions:
>> > zet(N,s)=gettime();my(s=sum(n=1,N,n^-s));print("sum:",gettime());s
>> > vecz(N,n)=gettime();my(v=vector(n,t,zet(N,.5+I*t)));print("vec:",gettime());v
> [...]
>> > The final time is wrong.
>> >
>> > We should provide a version of gettime that return the time in microseconds
>> > since the start of the GP session so we could do
>> > t=gettime2();....;print(gettime2()-t;
>>
>>     I think getabstime() or something similar would be better but in general
>>   it's a good idea.
>
> It would return a t_INT, I suppose; not a C long as gettime does.
> Otherwise it would wrap within less than an hour on 32-bit archs :-)
>
>> > We could also provide a function printtime(t,s,...) which would do
>> > print("Time ",s," :",gettime2()-t);
>>
>>     Is it really necessary ?
>
> I don't think so either.
>
> Cheers,
>
>     K.B.
> --
> Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
> Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
> 351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
> F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
> `
>

```