-
Notifications
You must be signed in to change notification settings - Fork 253
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
Fix the missing parallel
feature flag for ark-serialize
#833
Conversation
Actually this is not as easy as I think: the problem is that we also implement Valid for things like Rc, but such structure is not "sendable". |
Should we comment out the current parallel implementation then? The problem seems to be as follows: parallel check always requires the elements to be sendable to other threads, and therefore this places a limitation |
This is a problem introduced by #811. I would rather that we revert the part there with removes |
I made an edit---now it has a different implementation. Since all the batch_check requests would be reduced to the base primitives, and many trivial data structures may not benefit from parallel check:
|
limitation of the current implementation: it copies. This is due to the argument being "Impl Iterator" and you cannot make it parallelizable without first pulling all the elements out from the iterator. The good thing, however, is that for EC points and pairing, such copying is usually worthy. |
batch | ||
.map(|x| (*x).clone()) | ||
.collect::<Vec<T>>() | ||
.into_par_iter() | ||
.try_for_each(|e| e.check())?; | ||
} |
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.
Why does the par_bridge
solution not work here?
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.
ParallelBridge
is implemented for Iterator + Send
. We no longer have Send
bound on batch
here. So we'd need to put an explicit bound: batch: impl Iterator<Item = &'a T> + Send
, but this propagates all the way up to Valid
, and would in turn lead to two definitions of batch_check
:
#[cfg(feature = "parallel")]
fn batch_check<'a>(batch: impl Iterator<Item = &'a Self> + ParallelBridge)...
#[cfg(not(feature = "parallel"))]
fn batch_check<'a>(batch: impl Iterator<Item = &'a Self>) ...
Description
This appears to be the blocker for a number of PRs since the latest test no longer allows a feature that is not declared in the Cargo.toml.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Files changed
in the GitHub PR explorerN/A:
Pending
section inCHANGELOG.md