# Repeated compilation for same function with extreme type instability

**URL:** <https://discourse.julialang.org/t/repeated-compilation-for-same-function-with-extreme-type-instability/114244>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 14, 2024, 10:38am UTC](https://discourse.julialang.org/t/repeated-compilation-for-same-function-with-extreme-type-instability/114244 "2024-05-14T10:38:02Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)\
**Post date:** [May 14, 2024, 3:11pm UTC](https://discourse.julialang.org/t/repeated-compilation-for-same-function-with-extreme-type-instability/114244/5 "2024-05-14T15:11:16Z")

</div>

Thankfully, I have created a minimal reproducible example:

```julia
f1() = rand() > 0.5 ? 1 : rand()
f2() = rand() > 0.5 ? 1 : rand()
f3() = rand() > 0.5 ? 1 : rand()
f4() = rand() > 0.5 ? 1 : rand()
f5() = rand() > 0.5 ? 1 : rand()
f6() = rand() > 0.5 ? 1 : rand()

ff() = f1() + f2() + f3() + f4() + f5() + f6()

@time ff()

```

0.007261 seconds (7.20 k allocations: 485.763 KiB, 98.70% compilation time)

```julia
@time (f1(), f2(), f3(), f4(), f5(), f6())

```

0.000019 seconds (6 allocations: 240 bytes)

Is there a way in Julia to mark `ff()` to be executed by interpretation instead of time consuming re-compilation?

---

_[View the full topic](https://discourse.julialang.org/t/repeated-compilation-for-same-function-with-extreme-type-instability/114244)._
