Ticket #6199 (closed defect: fixed)
Integer * int is slow
| Reported by: | fredrik.johansson | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.3.3 |
| Component: | basic arithmetic | Keywords: | |
| Cc: | robertwb | Author(s): | Robert Bradshaw |
| Report Upstream: | N/A | Reviewer(s): | Fredrik Johansson, Mike Hansen, Craig Citro |
| Merged in: | sage-4.3.3.alpha0 | Work issues: |
Description
sage: a = 123
sage: b = 456
sage: c = 456r
sage: timeit("a*b")
625 loops, best of 3: 312 ns per loop
sage: timeit("a*c")
625 loops, best of 3: 2.99 µs per loop
Ditto for +, -. If I understand the code correctly, there always is a coercion to Integer, which could be avoided. I'm not sure how to best fix this since the ring operators are not implemented in the Integer class itself.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

