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

ed25519_verify_cpu: remove allocation in hot path #3941

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions perf/src/sigverify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,11 @@ pub fn shrink_batches(batches: &mut Vec<PacketBatch>) {
pub fn ed25519_verify_cpu(batches: &mut [PacketBatch], reject_non_vote: bool, packet_count: usize) {
debug!("CPU ECDSA for {}", packet_count);
PAR_THREAD_POOL.install(|| {
batches
.par_iter_mut()
.flatten()
.collect::<Vec<&mut Packet>>()
.par_chunks_mut(VERIFY_PACKET_CHUNK_SIZE)
apfitzge marked this conversation as resolved.
Show resolved Hide resolved
.for_each(|packets| {
for packet in packets.iter_mut() {
if !packet.meta().discard() && !verify_packet(packet, reject_non_vote) {
packet.meta_mut().set_discard(true);
}
}
});
batches.par_iter_mut().flatten().for_each(|packet| {
if !packet.meta().discard() && !verify_packet(packet, reject_non_vote) {
packet.meta_mut().set_discard(true);
}
});
});
}

Expand Down
Loading