Detecting dynamic dispatch

Is there a way in Julia to detect if dynamic dispatch is happening or not for a given function call? Especially when the function doesnt allocate memory?

Thanks.

You should be able to use the @code_warntype to look for type-instabilities (which will cause dynamic dispatch). If all of the types in your function are concretely inferred, then there shouldn’t be any dynamic dispatch.

https://docs.julialang.org/en/stable/manual/performance-tips/#code-warntype

5 Likes

Thanks. I knew about this macro but wasn’t aware that you can also use it for detecting dynamic dispatch