Profiling
Profiling is what allows developers to get more insight into how the transaction is executed. You can inspect the call tree, see how many resources are used for different parts of the execution, and more!
Integration with cairo-profiler
snforge
is able to produce a file with a trace for each passing test (excluding fuzz tests).
All you have to do is use the --save-trace-data
flag:
$ snforge test --save-trace-data
The files with traces will be saved to snfoundry_trace
directory. Each one of these files can then be used as an input
for the cairo-profiler.
If you want snforge
to call cairo-profiler
on generated files automatically, use --build-profile
flag:
$ snforge test --build-profile
The files with profiling data will be saved to profile
directory.
Passing arguments to cairo-profiler
You can pass additional arguments to cairo-profiler
by using the --
separator. Everything after --
will be passed
to cairo-profiler
:
$ snforge test --build-profile -- --show-inlined-functions
📝 Note
Running
snforge test --help
won't show info aboutcairo-profiler
flags. To see them, runsnforge test --build-profile -- --help
.