pocketlang/test/benchmark/fib/fib.pk
Thakee Nathees df93b2c1ec gc bugs fixed
- popping operands from the stack was too early -fixed
- some temproary string objects weren't pushed to the vm's temp root
  -fixed
- and some minor bug fixed
2021-05-23 23:25:04 +05:30

16 lines
197 B
Plaintext

from lang import clock
def fib(n)
if n < 2 then return n end
return fib(n - 1) + fib(n - 2)
end
start = clock()
for i in 0..10
print(fib(28))
end
print('elapsed:', clock() - start, 's')