Parallelize CPU sig verify

This commit is contained in:
Greg Fitzgerald
2018-04-06 15:21:49 -06:00
parent 39f5aaab8b
commit 7d811afab1

View File

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