I’d like to present to you a small tool that I wrote today. It is quite interesting to keep track of functions gas costs in Solidity over time.
Why tracking?
As a project grows over time, there can be quite a bit of changes in the gas costs for any functions. Often these changes come without notice, e.g., you add changes to a helper functions that are used in many other functions as well. As you do this, you change the gas costs of all these functions as well.
As you may not notice this immediately, you may wonder a few months later why all of a sudden this one function costs double the amount of what it cost initially.
Lastly, it’s also fun to look at the gas costs development over time.
Tracking gas costs over time
One way to help you identify these situations, but also help you identify the specific point in time when the gas costs changed, is to the gas costs after important changes in a file. You can use the package to help you with this.
Tips
The most convenient way of using this is to setup continuous integration and the gas results after each run. But you can also run them locally and results only when you want to.
Notes
This is a very early stage of the package. There is (almost) no error handling, so use it correctly. There are also many possible features still missing. If there is anything in particular that you want, or an annoying bug, please create an issue for it. Or even better, create the PR fixing the bug/adding the feature.
Published at Sun, 26 May 2019 03:19:33 +0000