Skip to main content

mops bench

Run Motoko benchmarks.

mops bench [filter]

Put your benchmark code in bench/* files.

It is necessary to use bench package to write benchmarks.

The output format is a markdown table, so you can copy-paste it into your

How it works

Under the hood, Mops will:

  • Start a local replica on port 4944
  • Wrap each * file in a canister
  • Compile canisters with --force-gc flag and deploy them
  • Run each cell of the benchmark file as an update call
  • For each call measure usage of wasm instructions(performance_counter) and heap size(rts_heap_size)



Which replica to use.

Possible values:

  • dfx - use dfx local replica (default)
  • pocket-ic - use PocketIC light replica via pic.js wrapper


Select garbage collector.

Possible values:

  • copying (default)
  • compacting
  • generational
  • incremental


Save benchmark results to .bench/<filename>.json file.


Compare benchmark results with the results from .bench/<filename>.json file.


Verbose output.