Replies: 2 comments
-
BenchmarksI have run some benchmarks against commit e8b3a93e. 1,000 runsLink to GitHub Gist with gas snapshot for 1,000 optimizer runs. 5,000 runsLink to GitHub Gist with gas snapshot for 5,000 optimizer runs. 10,000 runs (current setting)Link to GitHub Gist with gas snapshot for 10,000 optimizer runs. 50,000 runsLink to GitHub Gist with gas snapshot for 50,000 optimizer runs. 4,294,967,295 runsLink to GitHub Gist with gas snapshot for 4,294,967,295 optimizer runs. Benchmark for the Withdraw FunctionThe
Side NoteUnfortunately, there is a bug in the |
Beta Was this translation helpful? Give feedback.
-
Locking, ended up sticking with 5,000 runs. |
Beta Was this translation helpful? Give feedback.
-
Context
We currently have the
--optimizer-runs
config option set to 10,000:v2-core/foundry.toml
Line 16 in 4918aca
What we want
The number of optimizer runs should be set according to how many times the developer expects the contract to be called. To quote the Solidity docs on this topic:
The Sablier V2 lockup contracts are "singletons" - they contain both storage and functionality, and are expected to be the main points of entry into the protocol. Assuming Sablier V2 is successful, the contracts will be called a great many number of times. Thus, we would ideally set the number of optimizer runs to the maximum value allowed, which is$2^{32}-1$ , just like Seaport does.
What we can get
Unfortunately, as discussed at point 8 in #279, a high number of optimizer runs significantly increases the size. Using commit 9fa613f1 and setting the$2^{32}-1$ , I have obtained a size of ~29kB for the pro contract, which is ~4.5kB over the ~24.5kB limit.
optimizer_runs
config option toAgain, to quote the Solidity docs:
Note about Yul IR
We are also using the Yul IR optimizer (
--via-ir
), so I am not sure we actually want to bump the optimizer runs to the maximum value possible. I have posted this as a question on Twitter, and I may also follow up in the Solidity server if I don't get a good response on Twitter.Beta Was this translation helpful? Give feedback.
All reactions