On Tue, Jun 25, 2013 at 11:44:10PM -0400, Daniel Micay wrote:
> Rust doesn't yet have a way to write data-parallel code, but when it does gain
> that, containers can just support partitioning themselves into ranges via
> `Iterator`. It will work for in-place mutation in parallel too.

I do not follow what you mean by "support partitioning themselves into
ranges via `Iterator`".  That said, I don't think the optimal
sequential protocol will necessarily be the optimal parallel protocol,
and it's not clear to me how general it will be to have a protocol
that yields slices. It'd work ok for vectors and btrees but perhaps
not that much else?

I suspect the best thing will be to have the iterable trait optimized
for sequential access, and provide a second trait to be used for
optimal parallel access, probably some kind of
"divide-and-conquer"-like trait that can split an iterator into two
other iterators. For types that lack the DivideAndConquer trait, you
could also have a poor man's D&C that is implemented in terms of an
iterator, or just serialize to a vec.


Niko
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to