Tim Peters <t...@python.org> added the comment:

[Tim]
> That's [Mark's code] cheaper than almost every case handled by
> perm_comb_small()'s current ... "iscomb" loop.

Although I should clarify they're aimed at different things, and don't overlap 
all that much. Mark's code, & even more so Raymond's extension, picks on small 
"n" and then looks for the largest "k" such that comb(n, k) can be done with 
supernatural speed.

But the existing perm_comb_small() picks on small "k" and then looks for the 
largest "n" such that "the traditional" one-at-a-time loop can complete without 
ever overflowing a C uint64 along the way.

The latter is doubtless more valuable for perm_comb_small(), since its 
recursive calls cut k roughly in half, and the first such call doesn't reduce n 
at all.

But where they do overlap (e.g., comb(50, 15)), Mark's approach is much faster, 
so that should be checked first.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to