code-423n4 / 2022-02-pooltogether-findings

0 stars 0 forks source link

Gas Optimizations #25

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Gas Optimizations

Cache array length in for loops:

Caching the array length in a for-loop saves gas as the length does not need to be read on every iteration.

The following loops could be refactored:

++i is more gas efficient than i++:

The following loops could be refactored:

PierrickGT commented 2 years ago

Duplicate of https://github.com/code-423n4/2022-02-pooltogether-findings/issues/9, https://github.com/code-423n4/2022-02-pooltogether-findings/issues/14