#18303: faster comparisons in AA and QQbar
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.7
Component: number fields | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/18303 | d4ee0f91df82a54df6c6959a28e72273176e04f4
Dependencies: #17890 | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):
* status: new => needs_review
* dependencies: => #17890
Old description:
> The comparisons of elements of `AA` can be much faster! We got
>
> 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: 680 ns per loop
> sage: a = AA(2).sqrt()
> sage: timeit("a < b", repeat=10, number=50000)
> 50000 loops, best of 10: 686 ns per loop
> }}}
>
> Also, instead of implementing `__cmp__` we implement `_cmp_` (that avoids
> one function call).
>
> see also:
> - #17890 (remove `_(rich)_cmp_impl`)
> - #18304 (comparisons involving integers and rationals)
New description:
The comparisons of elements of `AA` can be much faster! We got
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: 680 ns per loop
sage: a = AA(2).sqrt()
sage: timeit("a < b", repeat=10, number=50000)
50000 loops, best of 10: 686 ns per loop
}}}
Also, instead of implementing `__cmp__` we implement `_cmp_` (that avoids
one function call).
see also: #18304 (comparisons involving integers and rationals)
--
--
Ticket URL: <http://trac.sagemath.org/ticket/18303#comment:4>
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.