# Why did the doubly recursive fibonacci microbenchmark become relatively slower?

**URL:** <https://discourse.julialang.org/t/why-did-the-doubly-recursive-fibonacci-microbenchmark-become-relatively-slower/136248>\
**Category:** Internals & Design\
**Tags:** performance\
**Created:** [March 18, 2026, 6:43am UTC](https://discourse.julialang.org/t/why-did-the-doubly-recursive-fibonacci-microbenchmark-become-relatively-slower/136248 "2026-03-18T06:43:55Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![GeorgeGkountouras](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@GeorgeGkountouras](https://discourse.julialang.org/u/GeorgeGkountouras)\
**Post date:** [March 19, 2026, 6:43pm UTC](https://discourse.julialang.org/t/why-did-the-doubly-recursive-fibonacci-microbenchmark-become-relatively-slower/136248/22 "2026-03-19T18:43:28Z")

</div>

> [@gbaraldi](#):
>
> Because Julia can run multithreaded so codegen has to assume it will happen.

C++ and Rust can also run multi-threaded and don’t pay this cost. There should be a toggle, in the vein of Debug/Release builds. In dev/Debug mode, it may run with all protections, sanitizers, [borrow checkers](https://discourse.julialang.org/t/ann-borrowchecker-jl-a-borrow-checker-for-julia/127897), etc. In Release mode, it should have true 0-cost abstractions.

It’s perfectly fine for `juliac` to be this toggle. Which is why I asked whether it works today.

> [@Oscar\_Smith](#):
>
> It’s hard to see this being a problem for realtime julia. It’s only an extra ~3 (very cheap) instructions per function call and embedded code generally has few function calls.

First, it’s not about the specific cost, it’s having one in the first place. I’d rather my apps be doing actual number-crunching than book-keeping. Second, it’s the kind of thing that can sneak up on you and tank your performance. App developers don’t get control over inlining (other than hinting with `@inline` or LLVM intrinsics?), so they have to inspect the output of the compiler every time. Third, yes, I agree that ideally embedded leaf code should inline, but it doesn’t always. Embedded in this context means running in a standard desktop machine, by the way. Fourth, we’ve already seen a microbenchmark being impacted, it’s not hard to imagine a similar real workload with non-recursive function calls. Finally, I have to stress again that the runtime isn’t needed in this context, so the cost is paid “for nothing”.

---

_[View the full topic](https://discourse.julialang.org/t/why-did-the-doubly-recursive-fibonacci-microbenchmark-become-relatively-slower/136248)._
