How to speed up this function?

Putting aside the more general occurence (which is known to me, floats gets boxed when they cross functions) I’m still a bit surprised by the result here.

My intuition would have been: this function is going to be turned into a loop by the compiler (which an (fib1[@tailcall]) annotation can confirm) and that means the floats are going to be locally unboxed.

But as far as my rusty assembly goes that doesn’t seem to be the case (at least on 4.12).

1 Like