Skip to content

Commit

Permalink
Use hashset for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
rakanalh committed Aug 15, 2024
1 parent cbe7474 commit 17e4f5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/prover/src/runner.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::panic;
use std::collections::VecDeque;
use std::collections::{HashSet, VecDeque};
use std::marker::PhantomData;
use std::net::SocketAddr;
use std::sync::Arc;
Expand Down Expand Up @@ -935,7 +935,7 @@ where
sequencer_commitments: &[SequencerCommitment],
) -> anyhow::Result<Vec<SequencerCommitment>> {
let mut filtered = vec![];
let mut visited_l2_ranges = vec![];
let mut visited_l2_ranges = HashSet::new();
for sequencer_commitment in sequencer_commitments {
// Handle commitments which have the same L2 range
let current_range = (
Expand All @@ -945,7 +945,7 @@ where
if visited_l2_ranges.contains(&current_range) {
continue;
}
visited_l2_ranges.push(current_range);
visited_l2_ranges.insert(current_range);

// Check if the commitment was previously finalized.
let Some(status) = self.ledger_db.get_soft_confirmation_status(BatchNumber(
Expand Down

0 comments on commit 17e4f5b

Please sign in to comment.