"A Tragedy of Julia’s Type System"

For completeness, you reminded me that we had a previous thread about this. The best apples-to-apples benchmark I could come up with showed dynamic dispatch perf being pretty comparable: Does Julia Create a "1.5" Language Problem? - #115 by ToucheSir.

In practice, there is a lot that can shift this balance:

  1. The number of dispatch targets
  2. The complexity of the signatures being dispatched to
  3. The pattern of dispatch (i.e. are you getting a high cache hit rate)
  4. The complexity and nature of the argument and return types (i.e. how much overhead is caused by boxing)

I agree the picture does not look as bleak as the article suggests, but I would not take the other extreme and say dynamic dispatch is super optimized in Julia either. After finishing the comparison in the original thread, I also remember feeling like Python internals are too opaque to make good perf comparisons and it might be more productive to compare against languages with more explicit virtual method mechanisms (C++, Rust, C#, etc) instead.

But this goes back to the point about community priorities. Whether unintentional or caused by design choices, how much do we care about dynamic dispatch? I suspect the lack of interest comes from our focus on numerical and analysis code which has to deal with it less often, but it does still come up in places like the JuliaData ecosystem. I of course also have my personal opinion on whether we should be giving this more weight, but ultimately the decision is a communal one driven by the people working on the language and the ecosystem.

2 Likes