How to write type-stable dataflow graphs

That seems like a misunderstanding. I believe the right rule is something closer to: if you can do X at compile time, you pay the cost at compile time and not at run time. If you can’t do X at compile time, you pay the cost at run time. The cost of runtime type dispatch is likely higher than the cost of a simple three-way branch on an integer code, although the details of the dispatch matter a lot: [ANN] ManualDispatch.jl

In addition, I think method lookup and type-based dispatch are the same thing under most definitions of those terms.

2 Likes