Skip to content

Optimize storage slot usage by only computing once - #152

Open
kadenzipfel wants to merge 7 commits into
mainfrom
gas/slot-opt
Open

Optimize storage slot usage by only computing once#152
kadenzipfel wants to merge 7 commits into
mainfrom
gas/slot-opt

Conversation

@kadenzipfel

Copy link
Copy Markdown
Collaborator

Previously we used the pattern of LOAD_ELEMENT_FROM_KEYS then STORE_ELEMENT_FROM_KEYS to perform a storage read -> update -> write operation. The problem with this pattern was that both LOAD_ELEMENT_FROM_KEYS and STORE_ELEMENT_FROM_KEYS compute the storage slot, meaning that we're computing the slot twice rather than just keeping it on the stack

We optimize this by implementing simple MAPPING_SLOT macros in Hashmap.huff to simply retrieve the storage slot so that we can keep it on the stack while we read/write to the slot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant