Below is a flamegraph from a profiling run I just performed. For context, this is not exactly performance critical code, but it cannot be arbitrarily slow either. I would like to make sure I am reading/interpreting this correctly, specifically in connection with the following comment from the documentation:
Red bars are problematic only when they account for a sizable fraction of the top of a call stack, as only in such cases are they likely to be the source of a significant performance bottleneck
The red indicates type instabilities. My reading of the graph is that there are quite a few, but because they occur quite “low” in the call-stack all the “actual work” is done in a type-stable way. Therefore those type instabilities likely don’t affect the performance too significantly. By contrast if I had lots of red bars near the “top” of that graph, then I would be able to gain a lot by removing those type instabilities.
Do you agree with these statements? If not, I’d be grateful for more comments.
(I’m of course aware that type instabilities are not the only performance problem and there are other things to check too, but this post is just about type instability.) Thank you.