Bill Allombert on Thu, 10 Sep 2009 22:18:33 +0200


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

Re: TRY/CATCH is unnecessarily slow on OS X


On Thu, Sep 10, 2009 at 08:50:18AM +0200, Lorenz Minder wrote:
> Hi,
> 
> > Looking at your patch it seems that:
> > 1) you are doing getrusage(RUSAGE_SELF,...) instead of getrusage(0,...)
> > Your code seems more correct, I do not know why PARI does getrusage(0,...)
> > 2) You add the system time to the user time. This would change PARI behaviour.
> > 3) You are initializing T before calling TIMER() in TIMERstart.
> > That should not be necessary, because the return value of TIMER()
> > is discarded, but this is probably cleaner this way.
> 
> To clarify, I sent this patch because it would be a bit fishy to send
> timing results with a changed timer, but remain blurry on the exact
> changes to the timer.  The goal was not primarily to have it merged.

I understood, but since your patch is clearer better than the actual PARI
code, ignorin it was not an option.

> To your points 3):  I put this there first and foremost because it makes
> debugging easier.  (For one thing, you won't have to wonder about
> spurious negative delays in TIMER...)  It's also a bug, though:  In C,
> the use of uninitialized memory causes undefined behavior, even if it's
> just used to compute something that is thrown away anyways.  It's a
> minor problem, but I think this should be fixed.

I applied the change 1) and 3).

Cheers,
Bill.