Skip to content

Commit 598b0dd

Browse files
authored
[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
1 parent bb06fdb commit 598b0dd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ethereum/foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[profile.default]
22
solc_version = '0.8.4'
33
optimizer = true
4-
optimizer_runs = 200
4+
optimizer_runs = 10000
55
src = 'contracts'
66
# We put the tests into the forge-test directory (instead of test) so that
77
# truffle doesn't try to build them

ethereum/truffle-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ module.exports = {
230230
settings: {
231231
optimizer: {
232232
enabled: true,
233-
runs: 200,
233+
runs: 10000,
234234
},
235235
},
236236
},

0 commit comments

Comments
 (0)