>
> Do you mean that if Flow.chunk was implemented that it would behave
> differently from Enum or Stream.chunk?
>

It is not related to Flow.chunk per se. The issue is the following: as soon
as you call Flow.from_enumerable, the letters will be shuffled around.

This example

[0, 1, 2, 3] |> Enum.to_list


is guaranteed to return:

[0, 1, 2, 3]


But this example:

[0, 1, 2, 3] |> Flow.from_enumerable |> Enum.to_list


is *not* guaranteed to return the same list. In fact, for a large list,
each item will be processed in a separated processes that has seen only
*part* of the items.

When you enter in Flow-land, you lose ordering. The fastest your code can
is if it doesn't care about ordering at all. Partitioning can give you some
sense of ordering. However, you still don't have total ordering, because if
you want total ordering then it cannot be parallel.

So **assuming you care about the sequence when generating the initial
chunks**, your best option is to generate the chunks before entering flow
and then parallelize the computation on each chunk.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JQ4hMq3%2B6VVaiRrOb1k-W65x3WxReMB3NRyncxe%2BaTDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to