# Empty vs. value types, and vectorisation

**URL:** https://discourse.julialang.org/t/empty-vs-value-types-and-vectorisation/20433
**Category:** New to Julia
**Created:** [February 4, 2019, 4:21pm UTC](https://discourse.julialang.org/t/empty-vs-value-types-and-vectorisation/20433 "2019-02-04T16:21:41Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [February 4, 2019, 10:38pm UTC](https://discourse.julialang.org/t/empty-vs-value-types-and-vectorisation/20433/6 "2019-02-04T22:38:39Z")

</div>

Check out a previous answer of mine on this topic:

> [@Overhead of dynamic dispatch?](https://discourse.julialang.org/t/overhead-of-dynamic-dispatch/7089/5):
>
> There are a number of downsides to encoding a property of your thing in the type system: There will be more time spent in compilation — every time a different type hits a different function, Julia will compile a new specialized version just for that type. If this property is typically determined by a run-time value, then many functions working with your things will be type-unstable. Type-unstable variables can stymie optimizations, cause allocations and hit dynamic dispatch. Collections of ma…

Both your approaches (`Fluid{:Water}` and `Water <: Fluid`) encode `Water` into the type-system — and I’m not sure there’s a big semantic difference between the two. I think I’d prefer the abstract/struct one if that’s going to be the way you go… but you may want to consider if you actually need this encoded in the type system in the first place.

---

_[View the full topic](https://discourse.julialang.org/t/empty-vs-value-types-and-vectorisation/20433)._
