Skip to content

Commit

Permalink
refactor: Faster ReplicatedState::output_into_iter()
Browse files Browse the repository at this point in the history
  • Loading branch information
alin-at-dfinity committed Feb 16, 2024
1 parent 3082bc9 commit ce270ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rs/replicated_state/src/replicated_state.rs
Expand Up @@ -132,8 +132,8 @@ impl<'a> OutputIterator<'a> {
) -> Self {
let mut canister_iterators: VecDeque<_> = canisters
.iter_mut()
.filter(|(_, canister)| canister.has_output())
.map(|(owner, canister)| canister.system_state.output_into_iter(*owner))
.filter(|handle| !handle.is_empty())
.collect();

let mut rng = ChaChaRng::seed_from_u64(seed);
Expand Down Expand Up @@ -795,9 +795,7 @@ impl ReplicatedState {
&mut self.subnet_queues,
own_subnet_id,
// We seed the output iterator with the time. We can do this because
// we don't need unpredictability of the rotation, and we accept that
// in case the same time is passed in two consecutive batches we
// rotate by the same amount for now.
// we don't need unpredictability of the rotation.
time.as_nanos_since_unix_epoch(),
)
}
Expand Down

0 comments on commit ce270ec

Please sign in to comment.