-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to report view & pure method gas usage #92
Comments
For the cases where speed is important you could add a toggle in the config to disable it (I think it should be enabled by default though). |
@cameel Do you think so? I am inclined the other way because I've seen estimateGas really slow things down on Hardhat (by more than 2X which is what I would expect) and test suites make so many calls. Definitely worth benchmarking on a large project. |
Ah, that's way more than I expected. If it really slows things down that much then yeah, it might make sense to keep if off by default. BTW, let me know if you need help benchmarking it on some real-life projects. We have a nice setup in Solidity where we run a bunch of them (13+ mid to large projects, including OpenZeppelin, Uniswap v3, Gnosis, etc) in CI to test the compiler. As a part of this we can see a breakdown of how long each one took to run the whole test suite: https://app.circleci.com/pipelines/github/ethereum/solidity/22003/workflows/92d7ef3e-f94a-448c-9db1-16cc18d19e9a (all the |
Oh fantastic, thank you @cameel |
Would be cool to have this! |
This would be very useful for SolidState. |
This has been added in the latest release (2.0). The relevant options look like this gasReporter: {
// This option executes an additional `eth_estimateGas` for every `eth_call`
// detected by the reporter. If you have 1000's of tests setting it to true has a
// noticeable performance impact
reportPureAndViewMethods: true,
// This option can add several seconds to test startup time if you have
// 100's of contracts in your project. (It parses all the sources in your dependency tree
// to identify state variable declarations)
excludeAutoGeneratedGetters: true,
} https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.0.0 |
We should be able to use
estimateGas
for these.It impairs test speeds but this data is important for libraries.
(See prb-math 70)
The text was updated successfully, but these errors were encountered: