Skip to content
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

Rename split_off to split_off_left (as discussed in PR #189) #198

Merged
merged 3 commits into from
Jan 3, 2017

Conversation

schuster
Copy link
Contributor

@schuster schuster commented Jan 2, 2017

No description provided.

Copy link
Member

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts?

let a = self.a.drive_unindexed(consumer.split_off());
let b = self.b.drive_unindexed(consumer.split_off());
let a = self.a.drive_unindexed(consumer.split_off_left());
let b = self.b.drive_unindexed(consumer.split_off_left());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, pre-existing, but I wonder if here it would be better to do:

let reducer = consumer.to_reducer();
let a = self.a.drive_unindexed(consumer.split_off_left());
let b = self.b.drive_unindexed(consumer);
reducer.reduce(a, b);

Seems like it would avoid an unnecessary split, which is better for the find_first code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'll push that change.

@nikomatsakis
Copy link
Member

LGTM!

@nikomatsakis nikomatsakis merged commit 32f9cce into rayon-rs:master Jan 3, 2017
@bluss
Copy link
Contributor

bluss commented Jan 5, 2017

ndarray will attempt to use UnindexedProducer/this in a way where there is no ordering, I hope that it can be supported in some way? (Either split is not before/after the other) ascii art

@cuviper
Copy link
Member

cuviper commented Jan 5, 2017

@bluss That's... challenging. I guess find_first and find_last don't make sense in that context?

@cuviper
Copy link
Member

cuviper commented Jan 5, 2017

Perhaps those need to be in an OrderedParallelIterator, which ndarray would not implement. Then we may need an unordered split_off still, as opposed to this split_off_left.

@bluss
Copy link
Contributor

bluss commented Jan 5, 2017

In theory ndarray could offer a regular old iterator called .unorder_iter() which has no guaranteed element order (just whatever order is quicker to iterate). In the sense of defining the parallel iterator over that sequence, I think it's fine. Just like how the sequential version of find_first (Iterator::find) works fine on a hashmap iterator.

@nikomatsakis
Copy link
Member

@bluss I'm not sure I quite follow, but it feels like that can be modeled "locally" as saying that the order of items from matrix iterators is not defined (much like the order of hashmap's iterator is not defined). This sort of implies that find_first is not meaningful, but it'll do something. Is there a problem with that?

@nikomatsakis
Copy link
Member

In other words, I'm not sure we need to surface this distinction in the traits, though I agree we could.

@cuviper
Copy link
Member

cuviper commented Jan 5, 2017

Maybe that's worth a note in the find_first docs, that not all iterators are ordered usefully.

@bluss
Copy link
Contributor

bluss commented Jan 5, 2017

The correspondence to arbitrary order sequential iterators clears it up nicely I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants