# Type stable code is more expensive than type unstable code. Why?

**URL:** <https://discourse.julialang.org/t/type-stable-code-is-more-expensive-than-type-unstable-code-why/19171>\
**Category:** Performance\
**Created:** [January 1, 2019, 8:43pm UTC](https://discourse.julialang.org/t/type-stable-code-is-more-expensive-than-type-unstable-code-why/19171 "2019-01-01T20:43:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [January 1, 2019, 8:51pm UTC](https://discourse.julialang.org/t/type-stable-code-is-more-expensive-than-type-unstable-code-why/19171/2 "2019-01-01T20:51:25Z")

</div>

As I mentioned in the [other](https://discourse.julialang.org/t/type-stability-issues-when-using-staticarrays/19126/21) thread, _please_ use BenchmarkTools for benchmarking. And remember to interpolate the variables.

---

_[View the full topic](https://discourse.julialang.org/t/type-stable-code-is-more-expensive-than-type-unstable-code-why/19171)._
