Closed mo8it closed 9 months ago
Well, I think itertools adaptors are convenient first, not necessarily the fastest in every situation. We are working on specializing fold
methods (see #755 and related PRs) to improve on that front, and we would specialize try_fold
if we could do it on stable Rust.
If you think that specialize a method of our ProcessResults
is worthwhile, then it would surely be a nice addition. Or maybe another method/adaptor?
A function taking a vector can leverage all its information which process_results
simply can't do as it handles an iterator of results, but it's not supposed to do it as it would stop at the first error, which a vector would not do.
Those are two solutions for a similar problem but with different trade-offs. It's worth knowing but here is more about iterators than vectors, results or flattening so I close this.
See my post on the Rust forum with benchmarks of
process_results
in itertools: https://users.rust-lang.org/t/300x-more-efficient-flattening-of-vec-result-vec-t-e-in-the-worst-case/103841