#16127: Fix comparison of PARI objects
-------------------------------------+-------------------------------------
       Reporter:  pbruin             |        Owner:
           Type:  defect             |       Status:  new
       Priority:  critical           |    Milestone:  sage-6.4
      Component:  interfaces         |   Resolution:
       Keywords:  pari comparison    |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/pbruin/16127-gcmp                |  a119b00099787f5cb8c3cc8477119184e16806ee
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by pbruin):

 Replying to [comment:7 jdemeyer]:
 > Replying to [comment:5 pbruin]:
 > > Maybe it is better to write a variant of `gcmp_sage()` that calls
 `gcmp()` and catches errors using PARI's `pari_CATCH` and `pari_TRY`
 macros so that we don't have to raise Python exceptions.
 > If you do this, I would prefer to see this function in the PARI library
 (call it `gcmp_any()` for example). Hopefully, this can be done in a way
 which is acceptable for upstream.
 I ended up practically copying the existing (static) `gen2.c:gequal_try()`
 and calling it `gcmp_try()`.  PARI already has another (somewhat
 different) universal comparison function `cmp_universal()`; I don't think
 the PARI library currently has a use for this `gcmp_try()`.

 New branch coming soon, but here are the new timings (same notation as in
 comment:5), which leave nothing more to wish for in my opinion:
 {{{
               cmp      cmp         ==       ==          <        <
            before    after     before    after     before    after

 (a, a)     189 ns   176 ns     151 ns   142 ns     156 ns   156 ns
 (a, b)    1.38 µs   324 ns     568 ns   520 ns     608 ns   212 ns
 (a, c)     328 ns   276 ns     171 ns   272 ns     166 ns   178 ns
 (a, d)    1.06 µs   984 ns     500 ns   284 ns     572 ns   300 ns
 (a, e)     968 ns  1.27 µs     512 ns   224 ns     456 ns   332 ns
 (a, f)    1.23 µs  1.24 µs     580 ns   408 ns     532 ns   336 ns
 (b, b)     175 ns   164 ns     748 ns   157 ns     864 ns   216 ns
 (b, c)    3.96 µs   348 ns    1.59 µs   348 ns    1.42 µs   232 ns
 (b, d)    1.44 µs  1.38 µs     748 ns   336 ns     696 ns   352 ns
 (b, e)    1.47 µs     1 µs     796 ns   264 ns     624 ns   336 ns
 (b, f)    1.61 µs  1.24 µs     824 ns   404 ns     696 ns   480 ns
 (c, c)     176 ns   180 ns     153 ns   156 ns     140 ns   186 ns
 (c, d)    3.56 µs  2.52 µs    1.19 µs   288 ns    1.33 µs   348 ns
 (c, e)    3.04 µs  2.72 µs    1.24 µs   216 ns    1.18 µs   324 ns
 (c, f)    3.12 µs  2.52 µs    1.83 µs   288 ns     1.5 µs   292 ns
 (d, d)     182 ns   175 ns     556 ns   156 ns     492 ns   296 ns
 (d, e)    1.96 µs     1 µs     548 ns   232 ns     540 ns   328 ns
 (d, f)    2.28 µs  1.29 µs     672 ns   288 ns     640 ns   312 ns
 (e, e)     169 ns   176 ns     496 ns   153 ns     532 ns   328 ns
 (e, f)    2.16 µs   992 ns     620 ns   296 ns     548 ns   296 ns
 (f, f)     179 ns   181 ns     656 ns   158 ns     652 ns   328 ns
 (t, t)     166 ns   180 ns     568 ns   688 ns     708 ns   752 ns
 (t, u)    1.48 µs  1.48 µs     648 ns   788 ns     648 ns   772 ns
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/16127#comment:8>
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/d/optout.

Reply via email to