#5478: [with patch, needs review] RestrictedPartitions is very slow and a huge
memory hog
---------------------------+------------------------------------------------
 Reporter:  ddrake         |       Owner:  ddrake                   
     Type:  defect         |      Status:  new                      
 Priority:  major          |   Milestone:  sage-combinat            
Component:  combinatorics  |    Keywords:  combinat, partitions, gap
---------------------------+------------------------------------------------

Comment(by ddrake):

 Some benchmarks (all on sage.math):

 {{{
 BEFORE
 sage: get_memory_usage()
 695.7421875
 sage: ps = RestrictedPartitions(100, ([1,6..100] + [4,9..100]))
 sage: %time sum(1 for p in ps)
 CPU times: user 26.89 s, sys: 1.11 s, total: 28.00 s
 Wall time: 28.69 s
 74040
 sage: get_memory_usage()
 1781.41796875
 }}}

 {{{
 AFTER
 sage: get_memory_usage()
 699.828125
 sage: ps = Partitions(100, parts_in=([1,6..100] + [4,9..100]))
 sage: %time sum(1 for p in ps)
 CPU times: user 4.96 s, sys: 0.02 s, total: 4.98 s
 Wall time: 4.98 s
 74040
 sage: get_memory_usage()
 699.828125
 }}}

 The above example which prompted this ticket:

 {{{
 BEFORE
 sage: get_memory_usage()
 695.73828125
 sage: ps = RestrictedPartitions(3000, [10,50,100,500,1000])
 sage: %time sum(1 for p in ps)
 CPU times: user 5.69 s, sys: 0.21 s, total: 5.90 s
 Wall time: 6.05 s
 3506
 sage: get_memory_usage()
 935.48046875
 }}}

 {{{
 AFTER
 sage: get_memory_usage()
 699.82421875
 sage: ps = Partitions(3000, parts_in=[10,50,100,500,1000])
 sage: %time sum(1 for p in ps)
 CPU times: user 1.08 s, sys: 0.00 s, total: 1.08 s
 Wall time: 1.09 s
 3506
 sage: get_memory_usage()
 699.82421875
 }}}

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