Use Memory Type Variable Instead of Storage Type Variable in Event to Save Gas#282
Open
HighBe wants to merge 1 commit intoOokiTrade:developmentfrom
Open
Use Memory Type Variable Instead of Storage Type Variable in Event to Save Gas#282HighBe wants to merge 1 commit intoOokiTrade:developmentfrom
HighBe wants to merge 1 commit intoOokiTrade:developmentfrom
Conversation
Contributor
|
Hi @HighBe , we are aware of the issue. we might implement it next time we upgrade the DAO. however right now it doesn't bring us immediate benefit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, we are a research group on programming languages and software engineering. We recently have conducted a systematic study about Solidity event usage, evolution, and impact, and we are attempting to build a tool to improve the practice of Solidity event use based on our findings. We have tried our prototype tool on some of the most popular GitHub Solidity repositories, and for your repository, we find a potential optimization of gas consumption arisen from event use.
The point is that when we use emit operation to store the value of a certain variable,
local memory type variablewould be preferable tostorage type (state) variableif they hold the same value. The reason is that an extra SLOAD operation would be needed to access the variable if it is storage type, and the SLOAD operation costs 800 gas.For your repository, we find that several event uses can be improved.