Skip to content

Commit

Permalink
Preallocate all the memory we might need pessimistically
Browse files Browse the repository at this point in the history
Co-authored-by: MOZGIII <[email protected]>
  • Loading branch information
dmitrylavrenov and MOZGIII authored Mar 20, 2024
1 parent fc1a89e commit d0a7fc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/pallet-bioauth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ pub mod pallet {
let current_moment = T::CurrentMoment::now();
let possibly_expired_authentications = <ActiveAuthentications<T>>::get();
let possibly_expired_authentications_len = possibly_expired_authentications.len();
let mut expired_validator_public_keys = vec![];
let mut active_authentications = vec![];
let mut expired_validator_public_keys = Vec::with_capacity(possibly_expired_authentications_len);
let mut active_authentications = Vec::with_capacity(possibly_expired_authentications_len);
for possible_expired_authentication in possibly_expired_authentications {
if possible_expired_authentication.expires_at > current_moment {
active_authentications.push(possible_expired_authentication);
Expand Down

0 comments on commit d0a7fc3

Please sign in to comment.