Skip to content

avoid double account cache lookup #20145

@mattsse

Description

@mattsse

Describe the feature

on cache miss

match self.caches.get_storage(&account, &storage_key) {
SlotStatus::NotCached => {
self.metrics.storage_cache_misses.increment(1);
let final_res = self.state_provider.storage(account, storage_key)?;
self.caches.insert_storage(account, storage_key, final_res);
Ok(final_res)
}

we end up looking up the account cache twice

let account_cache = self.storage_cache.get(&address).unwrap_or_default();

we can avoid this if we also return the optional account cache here:

pub(crate) fn get_storage(&self, address: &Address, key: &StorageKey) -> SlotStatus {

Additional context

No response

Metadata

Metadata

Assignees

Labels

C-enhancementNew feature or requestC-perfA change motivated by improving speed, memory usage or disk footprint

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions