pub fn scan_account_storage<F, B>(&self, fork_id: Fork, scan_func: F) -> Vec<B>
    where
        F: Fn(&StoredAccount, &mut B) -> (),
        F: Send + Sync,
        B: Send + Default,
    {
        let storage_maps: Vec<Arc<AccountStorageEntry>> = self
            .storage
            .read()
            .unwrap()
            .values()
            .filter(|store| store.fork_id == fork_id)
            .cloned()
            .collect();
        storage_maps
            .into_par_iter()
            .map(|storage| {
                let accounts = storage.accounts.accounts(0);
                let mut retval = B::default();
                accounts
                    .iter()
                    .for_each(|stored_account| scan_func(stored_account, &mut retval));
                retval
            })
            .collect()
    }
/// Scan a specific fork through all the account storage in parallel with sequential read
// PERF: Sequentially read each storage entry in parallel
Scan a specific fork through all the account storage in parallel with sequential read
PERF: Sequentially read each storage entry in parallel
Scan a specific fork through all the account storage in parallel with sequential read PERF : Sequentially read each storage entry in parallel
pub fn scan_account_storage<F, B>(&self, fork_id: Fork, scan_func: F) -> Vec<B>
    where
        F: Fn(&StoredAccount, &mut B) -> (),
        F: Send + Sync,
        B: Send + Default,
    {
        let storage_maps: Vec<Arc<AccountStorageEntry>> = self
            .storage
            .read()
            .unwrap()
            .values()
            .filter(|store| store.fork_id == fork_id)
            .cloned()
            .collect();
        storage_maps
            .into_par_iter()
            .map(|storage| {
                let accounts = storage.accounts.accounts(0);
                let mut retval = B::default();
                accounts
                    .iter()
                    .for_each(|stored_account| scan_func(stored_account, &mut retval));
                retval
            })
            .collect()
    }
pub fn scan_account_storage < F , B > ( & self , fork_id : Fork , scan_func : F ) -> Vec < B > where F : Fn ( & StoredAccount , & mut B ) -> ( ) , F : Send + Sync , B : Send + Default , { let storage_maps : Vec < Arc < AccountStorageEntry > > = self . storage . read ( ) . unwrap ( ) . values ( ) . filter ( | store | store . fork_id == fork_id ) . cloned ( ) . collect ( ) ; storage_maps . into_par_iter ( ) . map ( | storage | { let accounts = storage . accounts . accounts ( 0 ) ; let mut retval = B :: default ( ) ; accounts . iter ( ) . for_each ( | stored_account | scan_func ( stored_account , & mut retval ) ) ; retval } ) . collect ( ) }
Scan a specific fork through all the account storage in parallel with sequential read
PERF: Sequentially read each storage entry in parallel
Scan a specific fork through all the account storage in parallel with sequential read PERF : Sequentially read each storage entry in parallel
&self
fork_id
Fork
scan_func
F
&self
fork_id
Fork
scan_func
F