I also got `nim c` 's code running twice as fast as `nim cpp` 's code. See some 
previous discussion: 
[https://forum.nim-lang.org/t/1779](https://forum.nim-lang.org/t/1779) \- there 
are cases where Nim's generated C code "inspires" the C compiler to "unroll the 
last few recursions" and save 4x or 8x or maybe even 16x depending the number 
of funcalls (depending on the unroll amount). It's not quite constant folding. 
disassembly and looking for `callq` can be helpful here.

I think the result is correct by the more old school definition starting from 
"1 1 2 3 5" (with indexing starting at zero), not "0 1 1 2 3 5" as per 
[https://en.wikipedia.org/wiki/Fibonacci_number](https://en.wikipedia.org/wiki/Fibonacci_number)
 { or maybe the indexing is not what @miran expects, but he uses a ";-)" }. 
Anyway, there is sort of "more than one right answer" in a couple of ways 
depending on index origin or 0 inclusion.

Reply via email to