-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster each permutation #5127
Faster each permutation #5127
Conversation
A pull request generally shouldn't contain merge commits -- can you update your copy of the rust incoming branch and then rebase your branch off incoming and force-push ( |
On 02/26/2013 03:58 PM, Tim Chevalier wrote:
Thanks! That looks much better. Tommy M. McGuire |
@tmmcguire I believe that pcwalton was just remarking on the comment |
On 03/04/2013 01:51 PM, Ben Striegel wrote:
That makes sense. I thought he was talking about something related to To tell the truth, I don't know whether it ought to fail or not, either, Tommy M. McGuire |
Let's please make it fail on bad input instead of silently returning. That is consistent with other functions in core. |
Looks like this is still valid, @tmmcguire are you going to complete this or should I close? |
improve 'iter_nth_zero' documentation closes rust-lang#5115 changelog: Improve the documentation of `iter_nth_zero`
This is a replacement each_permutation that is somewhat faster than the previous version (and 2x faster, according to my testing, than the versions on the mailing list in January). The algorithm is based on "Generation in lexicographic order" section in Wikipdedia (http://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order).
I also exposed a function to reverse a portion of a vector which is used by the algorithm and seems like it might be something someone would want.
Finally, there's a each_permutation_ref that eliminates the Copy type requirement.