Performance profiling

In the past, several SMTK users have asked about tools to understand performance. Instruments on macos is excellent but if you aren’t having the performance problem on macos, it does you no good. On linux, oprofile is a headache to use.

I recently ran across perf and speedscope, which have been wonderful! To set up, you install them

dnf install perf # for Fedora/RedHat systems
npm install speedscope

and then run the executable you want to profile:

perf record --call-graph fp -F 999 /path/to/executable args
perf script -i perf.data > profile.txt
speedscore

At the end, speedscore opens in your default browser; you click the “Browse” button and select profile.txt. Then you can see a flamegraph with time on the horizontal axis and the call stack on the vertical axis.