Bill Allombert on Wed, 09 Sep 2009 15:09:22 +0200

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

Re: TRY/CATCH is unnecessarily slow on OS X

On Wed, Sep 09, 2009 at 06:01:19AM +0200, Lorenz Minder wrote:
> Hi Bill,
> Great.  This looks very acceptable.
> I guess the question now is:  Given that TRY/CATCH is meant only for
> internal use, and that a different error handling mechanism is under way,
> do you think the number of uses of those macros in libpari warrant a patch
> that uses _setjmp() when possible?

There is still the issue that PARI should behave in the same way
on all system. Imagine the user change the signal blocked set asynchronously
during TRY/CATCH and their changes get reverted on some system and not others...
(and it depends on the race condition...)

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.

So I do not see how this avoid the negative timing.