cesanta / v7

Embedded JavaScript engine for C/C++
Other
1.43k stars 177 forks source link

Recursive function slowdown #564

Open ScriptBasic opened 8 years ago

ScriptBasic commented 8 years ago

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));