#4533: [with patch; needs work] divisors function slow for integers
----------------------+-----------------------------------------------------
 Reporter:  robertwb  |        Owner:  tbd       
     Type:  defect    |       Status:  new       
 Priority:  major     |    Milestone:  sage-3.2.1
Component:  algebra   |   Resolution:            
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by robertwb):

 I'll make those fixes, and write a special case for word-sized integers.
 It should be noted that *sorting* the output often takes the majority of
 the time

 {{{
 sage: sage: n = ZZ(odd_part(factorial(31)))
 sage: sage: time _ = divisors(n)
 CPU times: user 0.53 s, sys: 0.02 s, total: 0.54 s
 Wall time: 0.55 s
 sage: sage: time _ = divisors(n, sorted=False)
 CPU times: user 0.15 s, sys: 0.02 s, total: 0.17 s
 Wall time: 0.17 s

 sage: n = factorial(25)
 sage: time _ = divisors(n)
 CPU times: user 1.07 s, sys: 0.05 s, total: 1.12 s
 Wall time: 1.12 s
 sage: time _ = divisors(n, sorted=False)
 CPU times: user 0.33 s, sys: 0.05 s, total: 0.38 s
 Wall time: 0.38 s
 }}}

 Originally I wasn't sorting the output, which was why I thought I was so
 much faster. (The original code sorted the output too, but it was slow
 enough that the sorting didn't dominate.)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4533#comment:8>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to