<aside>

Per-function gas figures for the open contract, straight from the compiler's static analysis, with a fix suggested wherever a cost is unbounded or unusually high.

</aside>

When to use it

When a function feels expensive, when you are choosing between two implementations, and before Chain Fit, which turns these figures into money.

Steps

  1. Open the contract.
  2. Click the Gas profiler icon in the top bar (the gauge), then Profile Gas.
  3. Read the table. Each state-changing function is listed with its execution cost and, where the compiler could not prove a bound, the word Unbounded and the reason.

The gas profiler on the Simple DAO template: per-function execution cost and the suggested fixes.

The gas profiler on the Simple DAO template: per-function execution cost and the suggested fixes.

Reading the figures

The numbers are solc's static upper bounds for execution only. They exclude the 21,000 gas base cost of a transaction and the cost of calldata. Unbounded means the compiler could not prove a limit, usually because of a loop or a call into another contract, not that the function is necessarily slow.

What you get

Next

6. Chain Fit


Monsmith for Monad builders