AcctIdx: support unref first class for perf (#20638)

This commit is contained in:
Jeff Washington (jwash) 2021-10-14 08:36:53 -05:00 committed by GitHub
parent e11f1b3e9e
commit 9b042fed30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1637,9 +1637,8 @@ impl<T: IndexValue> AccountsIndex<T> {
}
pub fn unref_from_storage(&self, pubkey: &Pubkey) {
if let Some(locked_entry) = self.get_account_read_entry(pubkey) {
locked_entry.unref();
}
let map = &self.account_maps[self.bin_calculator.bin_from_pubkey(pubkey)];
map.read().unwrap().unref(pubkey)
}
pub fn ref_count_from_storage(&self, pubkey: &Pubkey) -> RefCount {

View File

@ -290,6 +290,10 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
})
}
pub fn unref(&self, pubkey: &Pubkey) {
self.get_internal(pubkey, |entry| entry.map(|entry| entry.add_un_ref(false)));
}
pub fn upsert(
&self,
pubkey: &Pubkey,