My understanding is that runtime dispatch is not always problematic. E.g. exceptions result in runtime-dispatch, but that should not affect performance as long as the exception is not raised. Then there are runtime dispatches due to type instabilities in e.g. some numerical computations, which in general can be problematic.
So, currently I have a large numerical codebase and I want to track down type instabilities. JET.jl being a static analysis tool reports all possible runtime dispatches, so its output ends up being very noisy in that sense. So, I used ProfileView.jl on a small part of the code that might be problematic. I have the following output.
The big read on the top right is somewhere in the
CHOLMOD module of SparseArrays.jl. This is what I see on descending there using Cthulhu.
So, all the runtime dispatch guarded by conditionals should not be problematic since they’re only executed during exceptional control flow, which leaves the call to
So, I am not sure if I should worry about that. Is its return type marked red because it is behind a
Ref, or is it something else? Is it fine this way, or is this indicative of some type instability and/or performance pathology?