v7 icon indicating copy to clipboard operation
v7 copied to clipboard

Recursive function slowdown

Open ScriptBasic opened this issue 8 years ago • 0 comments

I have noticed that V7 performance takes a dive when doing recursive function calls. Try this Fibonacci example to see what I mean. Fibonacci(32) should allow you to have lunch before completion. :-(

function fibonacci(n) {
  if (n <= 2) {
    return 1;
  } else {
    return fibonacci(n - 1) + fibonacci(n - 2);
  }
}   

print(fibonacci(24));

ScriptBasic avatar Sep 12 '16 05:09 ScriptBasic