Parallelize CPU sig verify

This commit is contained in:
Greg Fitzgerald 2018-04-06 15:21:49 -06:00
parent 39f5aaab8b
commit 7d811afab1
1 changed files with 11 additions and 13 deletions

View File

@ -73,19 +73,17 @@ fn verify_packet(packet: &Packet) -> u8 {
#[cfg(not(feature = "cuda"))]
pub fn ed25519_verify(batches: &Vec<SharedPackets>) -> Vec<Vec<u8>> {
let mut locks = Vec::new();
let mut rvs = Vec::new();
for packets in batches {
locks.push(packets.read().unwrap());
}
for p in locks {
let mut v = Vec::new();
v.resize(p.packets.len(), 0);
v = p.packets.par_iter().map(|x| verify_packet(x)).collect();
rvs.push(v);
}
rvs
batches
.into_par_iter()
.map(|p| {
p.read()
.unwrap()
.packets
.par_iter()
.map(verify_packet)
.collect()
})
.collect()
}
#[cfg(feature = "cuda")]