Skip to content

Recursive functions are rather slow #1067

@rdbyk

Description

@rdbyk

function x = fib(n)
if n < 2
x = n;
else
x = fib(n-1) + fib(n-2);
end
endfunction

in Nelson 0.7.12.0

tic;fib(25);toc
Elapsed time is 20.999976 seconds.

in Balisc/Scilab

--> tic;fib(25);toc
ans =

0.5551460

-->

It is not important to me, but I was just a little bit surprised, anyway I really like the evolution of Nelson.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions