Skip to content

Conversation

danhhz
Copy link
Contributor

@danhhz danhhz commented Mar 7, 2022

This allows for e.g. indexing differential Descriptions by their lower
to stitch them together.

This allows for e.g. indexing differential Descriptions by their lower
to stitch them together.
Copy link
Contributor Author

@danhhz danhhz left a comment

Choose a reason for hiding this comment

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

@frankmcsherry I double-checked after office hours and it looked like we indeed didn't have this. no hurry at all! we might want something like this eventually, but not soon


impl<T: Ord+std::hash::Hash> std::hash::Hash for Antichain<T> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
let mut temp = self.elements.iter().collect::<Vec<_>>();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this temp Vec is unfortunate, should I be doing something different? maybe impl Hash for MutableAntichain (which requires that T be Ord) instead?

Copy link
Member

Choose a reason for hiding this comment

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

This seems fine to me, and is in-line with how we do equality. It just means that Hash is not super cheap, but that isn't the end of the world imo. A different take is that we should maintain antichains in normal form (sorted, say), which is a different amount of disruptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay then it works for me, too! It's still much faster than the alternative (repeatedly iterating through a list to call Eq). Just wanted to make sure I wasn't missing something.

@frankmcsherry
Copy link
Member

Looks good, and thanks!

@frankmcsherry frankmcsherry merged commit b578b67 into TimelyDataflow:master Mar 7, 2022
@github-actions github-actions bot mentioned this pull request Oct 29, 2024
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.

2 participants