Profiling Gjs code
Gjs has a secret built-in profiling tool. It is enabled by setting the GJS_DEBUG_PROFILER_OUTPUT environment variable to a filename prefix. Once enabled, sending SIGUSR1 will dump profile data (and reset the current data). For example:
$ env GJS_DEBUG_PROFILER_OUTPUT=$(pwd)/myapp gjs ./myapp.js <time passes> $ killall -10 gjs
This will create a file myapp.<pid>.0 with data. Sending further signals will increment the number.