angle-core icon indicating copy to clipboard operation
angle-core copied to clipboard

Update Core.sol: Gas Optimizations

Open 0xScratch opened this issue 1 year ago • 0 comments

The PR is mainly based on two types of optimizations besides some typos fixes:

  1. Improved For loops: These loops have been enhanced using unchecked block and changing i++ to ++i which is kind of gas efficient and probably doesn't create any logic change in the code as far as I am concerned. But still do take a look. for more reference - https://gist.github.com/grGred/9bab8b9bad0cd42fc23d4e31e7347144#for-loops-improvement
  2. Using internal functions for Modifiers: Whenever any particular modifier is kind of used several times in a code, it's better to use an internal function for it. This seems a worthy one for the current change. Also, we do need to take care of the tradeoffs that do occur with this kind of change.

Thanks @sogipec @GuillaumeNervoXS

0xScratch avatar Nov 14 '23 17:11 0xScratch