-
Notifications
You must be signed in to change notification settings - Fork 16
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 gas fee #401
Optimize gas fee #401
Conversation
Hello @huyhuynh3103 Thank you for your contribution! As you probably know the length of Did you compute the gas savings for this particular fix?
I believe that the first proposal would be good to include, but I am more hesitant about the second one. I do not expect the gas saving be significant while the code readability suffers from the second one. I am looking forward to reading your answer! Cheers, |
Hello @martinkersner
I have tested on an array with 4 elements
Gas used for each test case is:
I believe my proposal will reduce gas significantly if |
@huyhuynh3103 Thank you for the explanation! If I understand it correctly, you are testing the worst case scenario when we need to remove the item located at the end of the array. To generalize the gas savings per iteration, we would end up with following
(The gas values are in floating point because you did not deduct gas used for your gas measurement.) As you have mentioned in your comment, the optimization reduce gas significantly if I would like to suggest to keep only the optimization for |
@martinkersner, I have just updated upon your suggestion. Please review my changes again. |
@huyhuynh3103 Please fix the code formatting. |
@martinkersner I've done |
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.
LGTM!
Issue: #399: Optimize gas fee for deregisterProvingKey function in VRFCoordinator contract
Change description: