bench-fibo

Unnamed repository; edit this file 'description' to name the repository.
git clone https://logand.com/git/bench-fibo.git/
Log | Files | Refs | README

commit 5a87106d083b1e060665a172b133789acdf4adc2
parent 09fbfd26bba702cb7a624285ef259ccb704fd073
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sat, 16 Oct 2010 14:17:33 +0200

all tests are the same now

Diffstat:
MREADME | 6+++---
Mfibo25.l | 4++--
Mfibo25.lua | 6+++---
Mfibo30.l | 4++--
Mfibo30.lua | 6+++---
Mfibo40.l | 4++--
Mfibo40.lua | 6+++---
7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/README b/README @@ -2,6 +2,6 @@ | | pil64-3.0.4 | lua-5.1 | luajit-2.0.0 | c -O2 | |---------+-------------+---------+--------------+-------| -| fibo 25 | 0.03 | 0.02 | 0.02 | | -| fibo 30 | 0.27 | 0.19 | 0.08 | | -| fibo 40 | 31.08 | 22.70 | 8.82 | 1.31 | +| fibo 25 | 0.02 | 0.02 | 0.01 | | +| fibo 30 | 0.16 | 0.18 | 0.08 | | +| fibo 40 | 19.54 | 22.32 | 8.78 | 1.30 | diff --git a/fibo25.l b/fibo25.l @@ -1,6 +1,6 @@ (de fibo (N) - (if (> 2 N) - 1 + (if (< N 3) + N (+ (fibo (dec N)) (fibo (- N 2))) ) ) (fibo 25) (bye) diff --git a/fibo25.lua b/fibo25.lua @@ -1,9 +1,9 @@ -fib = function(n) +fibo = function(n) if n < 3 then return n else - return fib(n - 1) + fib(n - 2) + return fibo(n - 1) + fibo(n - 2) end end -print(fib(25)) +print(fibo(25)) diff --git a/fibo30.l b/fibo30.l @@ -1,6 +1,6 @@ (de fibo (N) - (if (> 2 N) - 1 + (if (< N 3) + N (+ (fibo (dec N)) (fibo (- N 2))) ) ) (fibo 30) (bye) diff --git a/fibo30.lua b/fibo30.lua @@ -1,9 +1,9 @@ -fib = function(n) +fibo = function(n) if n < 3 then return n else - return fib(n - 1) + fib(n - 2) + return fibo(n - 1) + fibo(n - 2) end end -print(fib(30)) +print(fibo(30)) diff --git a/fibo40.l b/fibo40.l @@ -1,6 +1,6 @@ (de fibo (N) - (if (> 2 N) - 1 + (if (< N 3) + N (+ (fibo (dec N)) (fibo (- N 2))) ) ) (fibo 40) (bye) diff --git a/fibo40.lua b/fibo40.lua @@ -1,9 +1,9 @@ -fib = function(n) +fibo = function(n) if n < 3 then return n else - return fib(n - 1) + fib(n - 2) + return fibo(n - 1) + fibo(n - 2) end end -print(fib(40)) +print(fibo(40))