[eth] Gas improvement: Increase optimizer runs to 10000 (#390)

* [eth]: Gas improvement: Increase optimizer runs to 1_000_000
Increasing optimizer runs will optimize the gas usage of methods more and will increase the contract size, hence the deployment cost.

Snapshot difference:
```
testBenchmarkGetUpdateFee() (gas: -101 (-0.076%))
testBenchmarkUpdatePriceFeedsIfNecessaryNotFresh() (gas: -334 (-0.189%))
testBenchmarkUpdatePriceFeedsNotFresh() (gas: -1312 (-0.416%))
testBenchmarkUpdatePriceFeedsIfNecessaryFresh() (gas: -1626 (-0.430%))
testBenchmarkUpdatePriceFeedsFresh() (gas: -1576 (-0.441%))
testBenchmarkGetPrice() (gas: -259 (-0.969%))
```

p.s: I read one place that `runs` is an estimate of how many times the contract is expected to be called as opposed to number of optimization passes through the code!

* Change optimizer_runs to 10000
This commit is contained in:
Ali Behjati 2022-11-18 15:42:19 +01:00 committed by GitHub
parent bb06fdb831
commit 598b0dde1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
[profile.default]
solc_version = '0.8.4'
optimizer = true
optimizer_runs = 200
optimizer_runs = 10000
src = 'contracts'
# We put the tests into the forge-test directory (instead of test) so that
# truffle doesn't try to build them

View File

@ -230,7 +230,7 @@ module.exports = {
settings: {
optimizer: {
enabled: true,
runs: 200,
runs: 10000,
},
},
},