Skip to content
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

Update Voting.sol: Gas Optimizations #307

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

0xScratch
Copy link
Contributor

πŸ› οΈ Fixes Issue

Inefficient 'For' loops

πŸ‘¨β€πŸ’» Changes proposed

  • Changed uint256 i = 0; -> uint256 i;, unsigned integers always have a default value of 0. Thus, it is a kind of waste of some gas to initialize variable to 0;

  • Efficient For loops -> Above point is maintained here. Plus i++ changed to ++i, does the same work with less gas used up

  • My code follows the code style of this project.

  • This PR does not contain plagiarized content.

  • The title of my pull request is a short description of the requested changes.

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

Our team will soon review your PR. Thanks @Aryan9592 :)

@github-actions github-actions bot added the SWOC23 label Oct 6, 2023
@Vikash-8090-Yadav
Copy link
Owner

LGTM. Thaks for this ssue.

@Vikash-8090-Yadav Vikash-8090-Yadav merged commit 5a1ecae into Vikash-8090-Yadav:main Oct 9, 2023
2 of 5 checks passed
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Thank you @Aryan9592 for taking out your valuable time in order to contribute to our project. Looking forward for more such amazing contributions :)

@0xScratch
Copy link
Contributor Author

Thank you @Aryan9592 for taking out your valuable time in order to contribute to our project. Looking forward for more such amazing contributions :)

For sure!

@0xScratch 0xScratch deleted the patch-1 branch October 9, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants