Skip to content

refactor: optimize gas for for loops#15

Open
theakalord wants to merge 1 commit intopendle-finance:mainfrom
theakalord:refactor/gas-optimization
Open

refactor: optimize gas for for loops#15
theakalord wants to merge 1 commit intopendle-finance:mainfrom
theakalord:refactor/gas-optimization

Conversation

@theakalord
Copy link
Copy Markdown

we can optimize gas usage for for loops.
default value for uint256 is 0, so we don't need to use uint256 i = 0.
and i != length will use less gas than i < length.

@anhthii
Copy link
Copy Markdown

anhthii commented Sep 2, 2024

@theakalord do we have a benchmark of the diffrence in gas reduction before and after the new changes?

Copy link
Copy Markdown

@magneticmeganlovesjhonny magneticmeganlovesjhonny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished

Copy link
Copy Markdown

@magneticmeganlovesjhonny magneticmeganlovesjhonny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished

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.

3 participants