You can also use pyinstrument to generate speedscope files which
can be used by speedscope.app to
generate interactive flamegraphs. To generate a speedscope.json
file for your script you may run:
pyinstrument -r speedscope -o speedscope.json path/script.py
From here, you can open this file in speedscope.app to experience an alternative to the tree-based view.