Stack performance in programming languages

前端 未结 8 2187
孤城傲影
孤城傲影 2020-12-31 17:41

Just for fun, I tried to compare the stack performance of a couple of programming languages calculating the Fibonacci series using the naive recursive algorithm. The code is

8条回答
  •  萌比男神i
    2020-12-31 18:31

    Note that if the Java Hotspot VM is smart enough to memoise fib() calls, it can cut down the exponentional cost of the algorithm to something nearer to linear cost.

提交回复
热议问题