-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
The solc optimizer config can be tweaked using the following properties:
- Solidity version (current: 0.8.17, latest: 0.8.19)
- Optimizer enabled (current: true)
- Yul IR pipeline enabled (current: false)
- Runs (current: 1 for truffle, 200 for hardhat, range: 1 - 4_294_967_295)
- Additional optimizer flags (reference, docs)
- Marking an inline assmebly block with "memory-safe" where applicable
- Config may be overidden per contract (reference)
These affect the following metrics:
- Solc compilation time (
time npx hardhat compile --force) - Contracts deployment size (
npx hardhat size-contracts) - Contracts deployment gas costs (
npm run test) - Transaction execution gas costs (
npm run test+ 'test-gas' CI job)
General rules of thumb:
- Lower optimizer runs = favors contract sizes and deployment cost over tx exceution costs (and vice versa)
- Yul ir pipeline increases the compilation time significantly
- Yul ir pipeline reduces contract sizes and deployment gas costs
- Yul ir pipeline mostly seem to slightly increase tx execution gas costs
- Recent hardhat V2.13.0 release has added better support for yul ir pipeline
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels