# Performance problems when dealing with deliberately type-unstable code. How to use type knowledge better?

**URL:** <https://discourse.julialang.org/t/performance-problems-when-dealing-with-deliberately-type-unstable-code-how-to-use-type-knowledge-better/52535>\
**Category:** Performance\
**Created:** [December 28, 2020, 8:40pm UTC](https://discourse.julialang.org/t/performance-problems-when-dealing-with-deliberately-type-unstable-code-how-to-use-type-knowledge-better/52535 "2020-12-28T20:40:37Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [December 30, 2020, 10:44am UTC](https://discourse.julialang.org/t/performance-problems-when-dealing-with-deliberately-type-unstable-code-how-to-use-type-knowledge-better/52535/27 "2020-12-30T10:44:29Z")

</div>

Interesting, so maybe a feasible path to achieve this while keeping code extensible would be to use a macro as in [Macro to write function with many conditionals - #8 by Skoffer](https://discourse.julialang.org/t/macro-to-write-function-with-many-conditionals/51616/8), and then add a mechanism to reload all functions that depend on the `subtypes` output if a new subtype has been added, effectively just overwriting the old version. I think that would give you both optimal speed, low allocations, and would allow others to add new subtypes after the fact.

---

_[View the full topic](https://discourse.julialang.org/t/performance-problems-when-dealing-with-deliberately-type-unstable-code-how-to-use-type-knowledge-better/52535)._
