#18303: faster comparisons in AA and QQbar
-----------------------------+----------------------------
   Reporter:  vdelecroix     |            Owner:
       Type:  enhancement    |           Status:  new
   Priority:  major          |        Milestone:  sage-6.7
  Component:  number fields  |         Keywords:
  Merged in:                 |          Authors:
  Reviewers:                 |  Report Upstream:  N/A
Work issues:                 |           Branch:
     Commit:                 |     Dependencies:
   Stopgaps:                 |
-----------------------------+----------------------------
 As remarked in #17890 the comparisons of elements in `QQbar` can be much
 faster by implementing `_richcmp_` instead of `__cmp__`. A naive
 implementation already gives a great speedup

 old timing
 {{{
 sage: a = AA(125/13)
 sage: b = AA(3/5)
 sage: timeit("a < b", repeat=10, number=50000)
 50000 loops, best of 10: 15.9 µs per loop
 sage: a = AA(2).sqrt()
 sage: timeit("a < b", repeat=10, number=50000)
 50000 loops, best of 10: 17.9 µs per loop
 }}}

 new timing
 {{{
 sage: a = AA(125/13)
 sage: b = AA(3/5)
 sage: timeit("a < b", repeat=10, number=50000)
 50000 loops, best of 10: 1.02 µs per loop
 sage: a = AA(2).sqrt()
 sage: timeit("a < b", repeat=10, number=50000)
 50000 loops, best of 10: 7.6 µs per loop
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18303>
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