I am trying to profile a piece of code that runs for about 15 minutes.
If I use the default settings in
Profile.init(), the profile buffer fills up when Julia is still compiling my code, so I don’t get any useful information.
I guess I should use
Profile.init(n=...) with a higher
n than the default. But what is the default? And how much memory should I budget? (i.e., how much would the buffer approximately consume if I set
Is it possible to save the profiling buffer in a file for later inspection?
Thanks for any help!
Just found the answer to my last question here: Julia Profiling Cheat Sheet - Thirld Word Blog (look for section " Trick: Saving profile results to disk")
The other thing I would suggest is finding a similar input on which your coffee only takes about a minute. Even if it’s not fully representative, the increased iteration speed will make improving things faster.
It’s not documented, but see the code. Specifically,
julia> Int(ccall(:jl_profile_maxlen_data, Csize_t, ()))
It would be great to
- have this documented (possibly by factoring out this code and
$(...)ing it into the docstring, or defining a constant),
- improve the interface by adding a higher-level argument the user can provide. frequently what one wants is not a buffer for
n samples, but “just large enough for this much runtime”, and then the API could figure it out.
Please open an issue.