-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize Sstore operation execution time #4836
Conversation
…once. Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
…forks) Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
evm/src/main/java/org/hyperledger/besu/evm/gascalculator/GasCalculator.java
Fixed
Show fixed
Hide fixed
evm/src/main/java/org/hyperledger/besu/evm/gascalculator/GasCalculator.java
Fixed
Show fixed
Hide fixed
evm/src/main/java/org/hyperledger/besu/evm/gascalculator/GasCalculator.java
Fixed
Show fixed
Hide fixed
evm/src/main/java/org/hyperledger/besu/evm/gascalculator/GasCalculator.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CodeQL warnings all appear legitimage, so please address them.
As this is changing an API on an interface it will be a breaking change and will need to land in 23.1.0-beta and not be cherry picked into 22.10.4.
Also, add a changelog entry under breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 just one nitpick about omitting final for local variables in gas calculators. Perhaps you had a reason to omit final?
nice that the gas calculator signatures can be simplified also.
evm/src/main/java/org/hyperledger/besu/evm/gascalculator/LondonGasCalculator.java
Outdated
Show resolved
Hide resolved
evm/src/main/java/org/hyperledger/besu/evm/gascalculator/IstanbulGasCalculator.java
Outdated
Show resolved
Hide resolved
…HANGELOG.md Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
* Optimize Sstore operation, get current value and original value only once. Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix javadoc. Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * refactoring (add a supplier implementation to better support all the forks) Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * delete unnecessary parameters, add final for some fields and modify CHANGELOG.md Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * add a missing parameter in Javadoc Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
* Optimize Sstore operation, get current value and original value only once. Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix javadoc. Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * refactoring (add a supplier implementation to better support all the forks) Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * delete unnecessary parameters, add final for some fields and modify CHANGELOG.md Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * add a missing parameter in Javadoc Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H ameziane.hamlat@consensys.net
PR description
This PR aims to improve SStore operation execution time by getting the original value and current value only once during gas cost and refund calculation. Currently, we make these two calls twice, and even with RocksDB cache, this has an impact on SStore performance as we can see in the CPU profiling flame graph below.

After this PR, we can see that getSorageValue (get current value) and getOriginalStorageValue are called only once.

Fixed Issue(s)
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog