# When and How to use Types

**URL:** <https://discourse.julialang.org/t/when-and-how-to-use-types/56659>\
**Category:** General Usage\
**Tags:** question, performance, parametric-types\
**Created:** [March 7, 2021, 7:33am UTC](https://discourse.julialang.org/t/when-and-how-to-use-types/56659 "2021-03-07T07:33:03Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 11, 2021, 11:36am UTC](https://discourse.julialang.org/t/when-and-how-to-use-types/56659/8 "2021-03-11T11:36:44Z")

</div>

Julia still uses a compiler to do optimization passes. In order for the compiler to replace some of the calculations you sometimes need to help the compiler prove the values or functions will not change.

Your questions are heading in the direction of constant propagation. You may want to start a new post specifically on that topic to get the best responses.

Here are are some prior posts:

> <https://stackoverflow.com/questions/54039266/how-to-do-constant-propagation-in-julia>

> [@ANN: Anyone need my 2.7x faster factorial (or gamma) function?](https://discourse.julialang.org/t/ann-anyone-need-my-2-7x-faster-factorial-or-gamma-function/19926/23):
>
> Possibly because the original PR was closed, so the threat of breaking SpecialFunctions is not that imminent, it requires quite a bit of investigation to find out the rationale for this PR. You should compose the PR message so that a person reading it for the first time, unaware of any context or history (these can be referenced later), can understand the motivation (why change) the implementation (what changed), and the benefits.

---

_[View the full topic](https://discourse.julialang.org/t/when-and-how-to-use-types/56659)._
