Files
wren/test/benchmark/fib.lua

11 lines
219 B
Lua
Raw Permalink Normal View History

2013-11-14 20:57:56 -08:00
function fib(n)
if n < 2 then return n end
return fib(n - 2) + fib(n - 1)
end
2013-11-22 08:55:22 -08:00
local start = os.clock()
for i = 1, 5 do
io.write(fib(28) .. "\n")
2013-11-22 08:55:22 -08:00
end
2013-11-23 21:00:47 -08:00
io.write(string.format("elapsed: %.8f\n", os.clock() - start))