Hi everyone,
I’m working on highly optimized contracts where the focus is gas efficiency.
Some default features such as checked indexing of arrays, zeroing of memory and (since solidity 0.8) checked arithmetic makes it harder to optimize contracts. I’m paying gas for something I don’t need.
Maybe there could be a way to enable/disable compiler features, either using pragma
or compiler flags. Having the safest behavior enabled by default is newcomers friendly, so how about something along the lines of:
solc --optimize --opt-unchecked-arithmetic --opt-unchecked-index Contract.sol
or:
pragma solidity 0.8.1;
pragma unchecked_arithmetic;
pragma unchecked_indexing;
...
I love that we have one de-facto language for the EVM because this means more brains on the same compiler and a bigger community.
Edit: I think compiler flags are better than pragma.