semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Little Gas Optimization

Open ShaheenRehman opened this issue 3 years ago • 0 comments

Description

++i costs a little less gas than i++ As i++ returns the non-incremented value & ++i returns the incremented value.

Related Issue

N/A

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

For More info check this: https://ethereum.stackexchange.com/questions/133161/why-does-i-cost-less-gas-than-i

And here are the gas snapshots, Before: semaphoreBefore After: semaphoreAfter

Thanks, AB Dee

P.S. I only changed 3 lines of code, other additions and deletions are just prettier's thing xD

ShaheenRehman avatar Aug 13 '22 21:08 ShaheenRehman