Dear Tim, dear sage-combinat,

>> The huge speed differnce can be seen here:
>>
>>    {{{
>>    sage: timeit('[Combinations(range(i), j).list() for (i, j) in
>>    CartesianProduct(range(15), range(15))]')
>>    5 loops, best of 3: 449 ms per loop
>>
>>    sage: timeit('[combinations(range(i), j) for (i, j) in
>>    CartesianProduct(range(15), range(15))]')
>>    5 loops, best of 3: 4.17 s per loop
>>    }}}
>>

I've got the same
{{{
sage: timeit('[Combinations(range(i),j).list() for (i,j) in
CartesianProduct(range(15),range(15))]')
5 loops, best of 3: 539 ms per loop
sage: timeit('[combinations(range(i),j) for (i,j) in
CartesianProduct(range(15),range(15))]')
5 loops, best of 3: 3.32 s per loop
}}}

But it seems that "combinations" wrapped from GAP is quicker on
special cases (especially when mset contains repetitions)
{{{
sage: l = [1,1,2,3,4,4,5,6,7,8,8,8,8]
sage: timeit('combinations(l,5)')
25 loops, best of 3: 10.3 ms per loop
sage: timeit('Combinations(l,5).list()')
5 loops, best of 3: 83.7 ms per loop
}}}

Even in mean
{{{
sage: l = [1,1,2,3,4,4,5,6,7,8,8,8,8]
sage: timeit('[combinations(l,i) for i in range(13)]')
5 loops, best of 3: 106 ms per loop
sage: timeit('[Combinations(l,i).list() for i in range(13)]')
5 loops, best of 3: 475 ms per loop
}}}

Vincent
-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@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.


Reply via email to