eth-gas-reporter
Gas usage per unit test. Average gas usage per method. A mocha reporter.
Install
npm install -g eth-gas-reporter
npm install --save-dev eth-gas-reporter
Configure for truffle
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*"
}
},
mocha: {
reporter: 'eth-gas-reporter'
}
};
Thanks
Everything here has been cannibalized from elsewhere and dropped into mocha's reporter facility. Many thanks to:
- @maurelian - once posted a slack picture of mocha reporting gas output instead time. Idea from him.
- @cag - wrote a really nice gas stats utility for the Gnosis suites. The table borrows from / is based his work.
- Neufund - expressing gas usage as a ratio of the block limit in their ico suite. That comes from them.