# 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:** 20

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [March 19, 2026, 11:48am UTC](https://discourse.julialang.org/t/why-did-the-doubly-recursive-fibonacci-microbenchmark-become-relatively-slower/136248/20 "2026-03-19T11:48:15Z")

</div>

> [@giordano](#):
>
> I see a 2.75x difference on zenv4 (so x86-64) with Julia v1.12. It’s 2.25x when I use Julia v1.0 on the same machine, with the same version of GCC (13.3)

As I noted in my post, gcc seems to be about 2x better than LLVM for [this benchmark](https://discourse.julialang.org/t/why-did-the-doubly-recursive-fibonacci-microbenchmark-become-relatively-slower/136248/5). So, it is good to separate two issues:

1. Julia has gotten slightly slower (by about 20%, it looks like), for tight recursive calls like the `fib` benchmark, due to the (useful!) introduction of GC safepoints in function calls. This is fine — you would never write this kind of recursive function (which does almost no work per function call) in a performance-critical scenario. Recursion is a powerful and elegant tool, but you often need to (e.g.) enlarge the base case (“coarsen” the recursion) in cases where performance matters: [Recursion in Julia — bad idea? - #5 by stevengj](https://discourse.julialang.org/t/recursion-in-julia-bad-idea/99304/5)
2. `gcc` has gotten better than LLVM for this benchmark, by around a factor of 2 — this is true even for C, as can be seen if you compile the C code with Clang. There’s probably nothing we can do about this on the Julia side. (Except, again: this is not how you would write a recursive function in a performance-critical context.)

---

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