Specialize CombinationsWithReplacement::nth#923
Merged
Philippe-Cholet merged 4 commits intorust-itertools:masterfrom Apr 26, 2024
Merged
Specialize CombinationsWithReplacement::nth#923Philippe-Cholet merged 4 commits intorust-itertools:masterfrom
CombinationsWithReplacement::nth#923Philippe-Cholet merged 4 commits intorust-itertools:masterfrom
Conversation
Steal how `next` increment indices, a bit improved. It will soon be used in `nth` (and more later).
Use the new `increment_indices`. This is done in a different commit because the git difference was difficult to read.
Use `pool.get_at` once! That way, `next` and `nth` will ressemble each other.
Similar to `next` except we increment indices n times before generating the vector item.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #923 +/- ##
==========================================
+ Coverage 94.38% 94.51% +0.12%
==========================================
Files 48 48
Lines 6665 6890 +225
==========================================
+ Hits 6291 6512 +221
- Misses 374 378 +4 ☔ View full report in Codecov by Sentry. |
phimuemue
reviewed
Apr 26, 2024
Member
There was a problem hiding this comment.
Thanks @Philippe-Cholet. I think it's technically correct, although I'd rewrite some parts. If you like your proposal better, fine with me.
Should we extract the "initialization" part into an own function?
phimuemue
approved these changes
Apr 26, 2024
phimuemue
reviewed
Apr 26, 2024
210e6e4 to
a250651
Compare
Philippe-Cholet
commented
Apr 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similarly to #914, I reorder
CombinationsWithReplacement::nextthen specializeCombinationsWithReplacement::nth.Benchmarks similar to #916 (comment)
I did not expect
nextto be a bit faster but I'm not complaining..nth(0)is a little bit slower but other.nth(..)s are faster, closely following allocations changes.