-
Notifications
You must be signed in to change notification settings - Fork 20
[POP-2983] Batch oblivious array minimum #1722
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I left a comment about a potential optimization. It isn't blocking though.
let pairs = res | ||
.chunks_exact(2) | ||
.flat_map(|chunk| izip!(chunk[0].clone(), chunk[1].clone()).collect_vec()) | ||
.collect_vec(); | ||
// compute minimums of pairs | ||
let flattened_res = min_of_pair_batch(&mut self.session, &pairs).await?; | ||
res = flattened_res | ||
.chunks_exact(len) | ||
.map(|chunk| chunk.to_vec()) | ||
.collect_vec(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let pairs = res | |
.chunks_exact(2) | |
.flat_map(|chunk| izip!(chunk[0].clone(), chunk[1].clone()).collect_vec()) | |
.collect_vec(); | |
// compute minimums of pairs | |
let flattened_res = min_of_pair_batch(&mut self.session, &pairs).await?; | |
res = flattened_res | |
.chunks_exact(len) | |
.map(|chunk| chunk.to_vec()) | |
.collect_vec(); | |
let mut res1 = vec![]; | |
std::mem::swap(&mut res1, &mut res); | |
let pairs: Vec<(_, _)> = res1 | |
.into_iter() | |
.tuples() | |
.flat_map(|(a, b)| izip!(a, b).collect_vec()) | |
.collect(); | |
// compute minimums of pairs | |
let flattened_res = min_of_pair_batch(&mut self.session, &pairs).await?; | |
res = flattened_res | |
.into_iter() | |
.chunks(len) | |
.into_iter() | |
.map(|chunk| chunk.collect()) | |
.collect_vec(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks!
No description provided.