Hey Nicolas, Thanks for investigating this! If you feel like it, I am all in favor > of a small patch taking care of the most urgent optimizations before > we go for the full cythonization. I am not surprised by the results of > your timings. In MuPAD we had done a similar optimization by using the > infinite value of IEEE floats (and its negative); it was quite fast, > and we did not even have to handle a special case. Could you give it a > shot using the following? > > sage: float('inf') > inf > > I only made the additional change to the max_part=float(infinity) default argument to IntegerListsLex in the integer_lists_speedup-ts.patch and got the following:
1127783 function calls (1127779 primitive calls) in 16.864 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 5096 2.495 0.000 6.065 0.001 integer_list.py:200(rightmost_pivot) 5096 2.190 0.000 11.775 0.002 integer_list.py:44(first) 108196 2.137 0.000 6.252 0.000 integer_list.py:366(<lambda>) 156168 2.048 0.000 2.974 0.000 integer_list.py:1080(ceiling) 156168 1.916 0.000 4.890 0.000 integer_list.py:1122(<lambda>) 277562 1.619 0.000 1.619 0.000 {len} 111200 1.475 0.000 2.114 0.000 integer_list.py:1061(floor) 108196 0.778 0.000 0.778 0.000 {min} 58132 0.684 0.000 2.500 0.000 integer_list.py:359(<lambda>) 53051 0.379 0.000 0.379 0.000 {max} 5096 0.301 0.000 18.239 0.004 integer_list.py:329(next) 47956 0.292 0.000 0.292 0.000 {method 'insert' of 'list' objects} 5097 0.195 0.000 18.490 0.004 integer_list.py:1141(__iter__) 15288 0.146 0.000 0.146 0.000 {range} 10191 0.116 0.000 0.116 0.000 {sum} 5096 0.049 0.000 0.049 0.000 integer_list.py:638(check) 1 0.033 0.033 18.522 18.522 finite_enumerated_sets.py:126(_list_from_iterator) ... sage: time p = Partitions(150, max_slope=-1, length=15).list() Time: CPU 2.86 s, Wall: 2.98 s without the patch I get approximately the same timings. I've created ticket #13840 <http://trac.sagemath.org/sage_trac/ticket/13840> for this and uploaded my patch (it's ready for review). I've put this patch at the front of the combinat queue (and moved it passed the partition options patch #13605). Best, Travis -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To view this discussion on the web visit https://groups.google.com/d/msg/sage-combinat-devel/-/6Deh8WGVO_8J. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.