Considering the language is still young, and the API is not very rich, what do you Mojo programmers use to profile your programs?
The methods I have tried with varying success are:
- Manually measuring the runtime of every function with the time library (using perf_counter_ns() function). This option surely works but it is quite a hassle for a very big program.
- Using
/usr/bin/timeto observe memory usage and general program runtime. - Using C API functions called with external_call FFI interface (one such example is POSIX clock_gettime) then doing the same thing as (1) (it’s the same thing, but it can be more accurate depending on the situation?).
- Using profilers such as
perforvalgrind. This does show some interesting and useful output, with Mojo symbols and function names showing up, but for some reason, I can only get it to show the time spent in functions up to a certain depth, which is really limiting due to the levels of indirection in my program.
I would also like to raise the question of whether or not the standard library is also profiled during development, and if so, then how. Perhaps this could give insight into optimizing our Mojo programs.
Thanks.