#14894: Fix PARI error handling (needed for future upgrade to PARI 2.6)
--------------------------------------+------------------------------
       Reporter:  vbraun              |        Owner:  jdemeyer
           Type:  defect              |       Status:  needs_work
       Priority:  major               |    Milestone:  sage-5.12
      Component:  packages: standard  |   Resolution:
       Keywords:  pari error signal   |    Merged in:
        Authors:  Peter Bruin         |    Reviewers:  Jeroen Demeyer
Report Upstream:  N/A                 |  Work issues:
         Branch:                      |       Commit:
   Dependencies:  #12142, #14873      |     Stopgaps:
--------------------------------------+------------------------------

Comment (by pbruin):

 Replying to [comment:28 jdemeyer]:
 > Replying to [comment:27 pbruin]:
 > > I would hope that setjmp() is very fast on most systems
 > It's not. I remember it being particularly slow on BSD (and therefore OS
 X) systems.
 I just found a discussion about this on the pari-dev mailing list:
 [http://pari.math.u-bordeaux.fr/archives/pari-dev-0909/msg00007.html].

 The reason is that in BSD, `setjmp()` saves the signal mask (which
 apparently is very expensive), while in System V-like systems it does not.
 BSD does have `_setjmp()` and `sigsetjmp(, 0)`, which are comparable to
 `setjmp()` on other systems.  According to the link above, the `setjmp()`
 variant that does not touch the signal mask is 2.5 to 12 times as fast as
 the one that does.

 Of course, for signal handling you are stuck with the slow version, but
 for other purposes one could use the fast version.  In our situation the
 question is whether we do one slow system call, or the slow one for signal
 handling plus the fast one for handling PARI errors.

 Finally, the discussion cited above mentions the idea of letting the user
 of the PARI library specify a function to call when an error occurs
 instead of the `setjmp()/longjmp()` construction.  This doesn't currently
 seem to be implemented, though.

--
Ticket URL: <http://trac.sagemath.org/ticket/14894#comment:29>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to