With #20731 and #20777 merged I got the more interesting
sage: %timeit U(200,1000000) 1 loop, best of 3: 169 ms per loop sage: %timeit V(200,1000000) 1 loop, best of 3: 196 ms per loop sage: %timeit W(200,1000000) 1 loop, best of 3: 610 ms per loop On 04/06/16 02:03, Nils Bruin wrote:
Hopefully a little more robust benchmark: sage: cython(""" ....: from sage.rings.integer import Integer ....: from sage.rings.integer cimport Integer ....: from sage.rings.rational import Rational ....: from sage.rings.rational cimport Rational ....: def U(a, n): ....: cdef Integer A=a ....: cdef Rational B ....: for i in range(n): ....: B=~a ....: def V(a, n): ....: cdef Integer A=a ....: cdef Rational B ....: cdef Integer One=Integer(1) ....: for i in range(n): ....: B=One/a ....: def W(a, n): ....: cdef Integer A=a ....: cdef Rational B ....: for i in range(n): ....: B=1/a ....: """) sage: %timeit U(200,1000000) 1 loop, best of 3: 362 ms per loop sage: %timeit V(200,1000000) 1 loop, best of 3: 338 ms per loop sage: %timeit W(200,1000000) 1 loop, best of 3: 820 ms per loop This suggests that we don't need unary division; we just need to avoid recreating one all the time.
-- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.