You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if itertools and rayon could work with each other. This would be very useful for gradually improving itertools-based code to work with rayon's parallel iteration.
Why not use rayon's existing iteration helper methods?
Some existing code uses itertools. To parallelize it, one would have to remove the itertools-based parts to use rayon. In some cases rayon may not provide a good alternative to the powerful iteration methods afforded by itertools, like cartesian_product.
What this would entail:
From a high level, this would require an impl IntoParallelIterator for itertools::Itertools. That should be enough, from an end-user perspective. Itertools would then have a feature-gated .into_par_iter method callable whenever the rayon feature flag is enabled. Note that it may also be possible to provide an impl for ParallelIterator directly so that rayon methods and itertools methods can be interspersed.
Providing an interface between rayon and itertools would be beneficial for parallelizing any existing code based on itertools, as well as reducing friction between complementary iterator tools.
Is this something you'd like to see? Would you be willing to accept a Pull Request adding this functionality?
Thanks for considering!
The text was updated successfully, but these errors were encountered:
Looking forward to this feature. I am currently using rayon iterator for ziping two arrays. Trying to zip multiple arrays and combination of rayon and itertool will definitely help.
From a high level, this would require an impl IntoParallelIterator for itertools::Itertools.
I think this would be served by the long-standing rayon request for Iterator support, rayon-rs/rayon#46, and we may have a way forward in rayon-rs/rayon#550. I'm not sure there's much that itertools could do in particular that couldn't be more broadly applicable, especially since all of these adaptors have to deal with generic Iterator inputs themselves.
On the rayon side, we've already tried to provide equivalents to many itertools methods -- at least those where the semantics of a parallel translation are straightforward.
dbkaplun
changed the title
Feature request: feature-gated rayon integration for itertools
Feature: feature-gated rayon integration for itertools
May 4, 2018
Hello,
It would be great if itertools and rayon could work with each other. This would be very useful for gradually improving itertools-based code to work with rayon's parallel iteration.
Why not use rayon's existing iteration helper methods?
cartesian_product
.What this would entail:
impl IntoParallelIterator for itertools::Itertools
. That should be enough, from an end-user perspective. Itertools would then have a feature-gated.into_par_iter
method callable whenever the rayon feature flag is enabled.Note that it may also be possible to provide an impl for
ParallelIterator
directly so that rayon methods and itertools methods can be interspersed.Providing an interface between rayon and itertools would be beneficial for parallelizing any existing code based on itertools, as well as reducing friction between complementary iterator tools.
Is this something you'd like to see? Would you be willing to accept a Pull Request adding this functionality?
Thanks for considering!
The text was updated successfully, but these errors were encountered: