Skip to content

perf: collect in apply_account_state is wasteful #3374

@DaniPopes

Description

@DaniPopes

The following collect is wasteful, we should be able to reuse the map since all we're doing is retaining changed slots and shrinking the value type (EvmStorageSlot -> StorageSlot).

cc @rakita for ideas on how to do this.

Ideally fixing this wouldn't be too invasive.

let changed_storage = account
.storage
.into_iter()
.filter(|(_, slot)| slot.is_changed())
.map(|(key, slot)| (key, slot.into()))
.collect();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions