@latticexyz/gas-report
TypeScript icon, indicating that this package has built-in type declarations

2.0.11 • Public • Published

Gas Report

Measure and report gas usage within forge tests

Add some reports to your forge tests

import { Test } from "forge-std/Test.sol";
import { GasReporter } from "@latticexyz/gas-report/src/GasReporter.sol";

contract ExampleTest is Test, GasReporter {
  function testGas() public {
    startGasReport("description of behavior to measure gas for");
    // do something here
    endGasReport();
  }
}

Then use the cli command to run tests and save the report:

pnpm gas-report --save gas-report.json

Or, if you have your own test command, you can pipe the output to gas-report --stdin:

GAS_REPORTER_ENABLED=true forge test -vvv --isolate | pnpm gas-report --stdin

Run pnpm gas-report --help for more details.

Readme

Keywords

none

Package Sidebar

Install

npm i @latticexyz/gas-report

Weekly Downloads

2,674

Version

2.0.11

License

MIT

Unpacked Size

30.7 kB

Total Files

14

Last publish

Collaborators

  • holic
  • alvarius
  • l_udens