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
Implement missing specializations on the PutBack adaptor and on the MergeJoinBy Iterator #372
Implement missing specializations on the PutBack adaptor and on the MergeJoinBy Iterator #372
Conversation
cb71c58
to
c6a2ce1
Compare
@Ten0 Could you add some quickcheck tests to ensure the specializations match the unspecialized behavior exactly? An unspecialized wrapper iterator is useful for these sorts of tests: itertools/benches/fold_specialization.rs Lines 8 to 24 in e983dda
|
…hese methods either
They were missing and did hurt the MergeJoinBy performance improvement on the `nth` method because we couldn't borrow iter without exposing new interfaces or using something like the `take_mut` crate.
b670bb6
to
d62e946
Compare
Well it did take quite some time to implement these, especially with Rust 1.24 compatibility, but at least now we've got a pretty reusable framework for testing any other specialization set we'd want to test on any This is also rebased on |
d62e946
to
b13e35f
Compare
Hello, |
Thank you for your contribution and patience! Unfortunately, I'm tied up with preparing for my dissertation proposal for the next couple weeks and can't thoroughly review this yet. I'll review as soon as possible. |
Thanks! bors r+ |
Merge conflict |
…sing_specializations # Conflicts: # src/merge_join.rs
bors r+ |
372: Implement missing specializations on the PutBack adaptor and on the MergeJoinBy Iterator r=jswrenn a=Ten0 Resolves #371 `count`, `last` and `nth` of the `MergeJoinBy` iterator are made faster when one of the iterators is completely consumed by directly calling the methods of the underlying only iterator left (there is benefit if the underlying iterator also specialized these methods). This is in particular useful when you want to count the number of different elements in the union of two sorted known-size iterators (`count`). Those methods are also specialized on the `PutBack` adaptor for the same performance reasons. The `nth` specialization on the `MergeJoinBy` iterator depends on the `nth` specialization on the `PutBack` adaptor working. Co-authored-by: Thomas BESSOU <thomas.bessou@hotmail.fr>
Build failed |
@orium Any idea what's going on with this build failure: https://travis-ci.org/rust-itertools/itertools/builds/644492455 It appears to be related to a |
Maybe we can try this again? |
bors r+ |
Build succeeded |
Resolves #371
count
,last
andnth
of theMergeJoinBy
iterator are made faster when one of the iterators is completely consumed by directly calling the methods of the underlying only iterator left (there is benefit if the underlying iterator also specialized these methods).This is in particular useful when you want to count the number of different elements in the union of two sorted known-size iterators (
count
).Those methods are also specialized on the
PutBack
adaptor for the same performance reasons.The
nth
specialization on theMergeJoinBy
iterator depends on thenth
specialization on thePutBack
adaptor working.