# How to easily troubleshoot type instability traps in complex code?

**URL:** <https://discourse.julialang.org/t/how-to-easily-troubleshoot-type-instability-traps-in-complex-code/91439>\
**Category:** Performance\
**Created:** [December 8, 2022, 6:39pm UTC](https://discourse.julialang.org/t/how-to-easily-troubleshoot-type-instability-traps-in-complex-code/91439 "2022-12-08T18:39:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiZ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tiz/32/211800_2.png) [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Post date:** [December 8, 2022, 6:39pm UTC](https://discourse.julialang.org/t/how-to-easily-troubleshoot-type-instability-traps-in-complex-code/91439/1 "2022-12-08T18:39:06Z")

</div>

I know that type stability is very important in Julia, so how can I get a warning when there is a type change in my code?

For example, I now have a very long code function `f(x)` that runs slowly, and I want to find out if there are some type conversion hidden in it that I didn’t find. Do you have any tools or advice to share on this?

Thank you for your attention!

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [December 8, 2022, 6:45pm UTC](https://discourse.julialang.org/t/how-to-easily-troubleshoot-type-instability-traps-in-complex-code/91439/2 "2022-12-08T18:45:16Z")

</div>

`@inferrred` and `@code_warntype` are the go to tools for checking type stability. If there is type stability, `Cthulhu` is an interactive exploration tool for finding type stability problems (and lots of other problems)
