#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:
-------------------------------------+-------------------------------------
Changes (by pbruin):

 * cc: was (added)


Comment:

 Here are some timings for this experimental branch:
 {{{
 a = pari(1)
 b = pari(1/2)
 c = pari(3.0)
 d = pari('x')
 e = pari('O(x)')
 f = pari('O(2)')
 k.<t> = FiniteField(29^10)
 u = t^2

 Timings with %timeit -c -r 1

               cmp      cmp         ==       ==          <        <
            before    after     before    after     before    after

 (a, a)     189 ns   173 ns     151 ns   144 ns     156 ns   154 ns
 (a, b)    1.38 µs   292 ns     568 ns   284 ns     608 ns   208 ns
 (a, c)     328 ns   292 ns     171 ns   276 ns     166 ns   204 ns
 (a, d)    1.06 µs  22.4 µs     500 ns   312 ns     572 ns  14.4 µs
 (a, e)     968 ns  16.6 µs     512 ns   352 ns     456 ns  13.7 µs
 (a, f)    1.23 µs  15.6 µs     580 ns   448 ns     532 ns  15.4 µs
 (b, b)     175 ns   174 ns     748 ns   153 ns     864 ns   216 ns
 (b, c)    3.96 µs   340 ns    1.59 µs   356 ns    1.42 µs   224 ns
 (b, d)    1.44 µs  26.4 µs     748 ns   284 ns     696 ns  13.8 µs
 (b, e)    1.47 µs  23.2 µs     796 ns   296 ns     624 ns  15.6 µs
 (b, f)    1.61 µs    26 µs     824 ns   432 ns     696 ns  21.2 µs
 (c, c)     176 ns   178 ns     153 ns   171 ns     140 ns   161 ns
 (c, d)    3.56 µs    26 µs    1.19 µs   280 ns    1.33 µs  21.2 µs
 (c, e)    3.04 µs  27.6 µs    1.24 µs   248 ns    1.18 µs  19.6 µs
 (c, f)    3.12 µs  22.4 µs    1.83 µs   360 ns     1.5 µs  13.7 µs
 (d, d)     182 ns   180 ns     556 ns   158 ns     492 ns  13.4 µs
 (d, e)    1.96 µs  19.2 µs     548 ns   236 ns     540 ns  21.2 µs
 (d, f)    2.28 µs  18.8 µs     672 ns   284 ns     640 ns    22 µs
 (e, e)     169 ns   174 ns     496 ns   148 ns     532 ns  23.2 µs
 (e, f)    2.16 µs  19.6 µs     620 ns   340 ns     548 ns  17.2 µs
 (f, f)     179 ns   166 ns     656 ns   160 ns     652 ns  22.8 µs
 (t, t)     166 ns   179 ns     568 ns   588 ns     708 ns   632 ns
 (t, u)    1.48 µs  1.36 µs     648 ns   632 ns     648 ns   656 ns
 }}}
 There is a nice speedup in most cases that do not involve a `PariError`,
 including practically all equality testings.  However, the slowdown in the
 cases where it does occur is probably not acceptable.  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.

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