#9882: slow random_element() for integer mod ring
-------------------------------+-------------------
       Reporter:  dmharvey     |        Owner:  tbd
           Type:  defect       |       Status:  new
       Priority:  major        |    Milestone:
      Component:  performance  |   Resolution:
       Keywords:               |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+-------------------

Comment (by ppurka):

 Replying to [comment:2 mmezzarobba]:
 > But I don't understand where the time goes:

 All of the time goes in returning an element of the integer mod ring.
 {{{
 sage: R = Integers(3^20)
 sage: a = 3^20; b = a+1
 sage: %timeit ZZ.random_element(-a, b)
 1000000 loops, best of 3: 705 ns per loop
 sage: %timeit R(ZZ.random_element(-a, b))
 100000 loops, best of 3: 2.07 us per loop


 sage: c = a-1
 sage: %timeit R(c)
 1000000 loops, best of 3: 749 ns per loop
 sage: c = (a-1)/2
 sage: %timeit R(c)
 100000 loops, best of 3: 7.71 us per loop
 }}}

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