# How to write type-stable dataflow graphs

**URL:** <https://discourse.julialang.org/t/how-to-write-type-stable-dataflow-graphs/57373>\
**Category:** New to Julia\
**Tags:** code\_warntype\
**Created:** [March 17, 2021, 11:55am UTC](https://discourse.julialang.org/t/how-to-write-type-stable-dataflow-graphs/57373 "2021-03-17T11:55:00Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Post date:** [March 18, 2021, 11:08am UTC](https://discourse.julialang.org/t/how-to-write-type-stable-dataflow-graphs/57373/6 "2021-03-18T11:08:44Z")

</div>

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](https://discourse.julialang.org/t/ann-manualdispatch-jl/47346)

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

---

_[View the full topic](https://discourse.julialang.org/t/how-to-write-type-stable-dataflow-graphs/57373)._
