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

Vectorize msgs #17

Merged
merged 11 commits into from
Sep 10, 2024
Merged

Vectorize msgs #17

merged 11 commits into from
Sep 10, 2024

Conversation

fkettelhoit
Copy link
Contributor

No description provided.

let (commitment, buffer): (Commitment, [u8; 32]) = recv_from(channel, p, "RNG")
.await?
.pop()
.ok_or(Error::EmptyMsg)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nice! I assume this should now be added to each recv_from (whenever it's not a vector that is being sent), do I get it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes exactly, we could also add back a method like recv_single_from, but since this behavior isn't needed very often I felt like this way of doing it was fine.

let c0 = commit(&d0[r].to_be_bytes());
let c1 = commit(&d1[r].to_be_bytes());
let cm = commit(&dm);
own_commitments.push((c0, c1, cm, dm))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, and much simpler this way!

@@ -673,7 +677,7 @@ pub(crate) async fn faand_precomp(
let triples = transform(xbits, ybits, &zbits, lprime);

// Step 2 assign objects to buckets.
let mut buckets: Vec<Vec<(Share, Share, Share)>> = vec![vec![]; length];
let mut buckets: Vec<SmallVec<[(Share, Share, Share); 3]>> = vec![smallvec![]; length];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just out of curiosity and to learn: what is the specific reason here for using SmallVec for buckets? Is there some performance-related reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. The vector is kept on the stack, bringing down the total runtime of the benchmark from 10 minutes to 7 minutes when I tested it with 250 records.

@fkettelhoit fkettelhoit merged commit 3336b1a into ferret-merged Sep 10, 2024
1 check failed
@fkettelhoit fkettelhoit deleted the vec-msgs branch September 10, 2024 18:13
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