From 140d33b167a744c9f6c449cb3007d40533e8a0f7 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 13 May 2014 10:36:44 +0300 Subject: [PATCH] c fibs (need to loop a lot to use time on it) --- test/bench/fibo.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/bench/fibo.c diff --git a/test/bench/fibo.c b/test/bench/fibo.c new file mode 100644 index 00000000..0a8c515d --- /dev/null +++ b/test/bench/fibo.c @@ -0,0 +1,29 @@ +#include + +int fibo(int n){ + int result; + int a = 0; + int b = 1; + int i = 1; + while( i < n ) + { + result = a + b; + a = b; + b = result; + i++; + } + return result; +} + +int main(void) +{ + int counter = 1000000; + int counter2 = counter; + int level = 76; + int fib ; + while(counter--) { + fib = fibo(level); + } + printf("%i times fib %d \n",counter2 , level); + +}