add simple loop bench
fiddled with run numbers a bit recording times with noop removed results slightly worse than hoped
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
#include<stdio.h>
|
||||
|
||||
int fibo(int n){
|
||||
int result;
|
||||
int a = 0;
|
||||
@ -17,10 +15,10 @@ int fibo(int n){
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int counter = 100000;
|
||||
int counter = 50000;
|
||||
int fib ;
|
||||
while(counter) {
|
||||
fib += fibo(20);
|
||||
fib = fibo(40);
|
||||
counter -= 1;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ int fibo_r(int n)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int counter = 1000;
|
||||
int counter = 100;
|
||||
int fib ;
|
||||
while(counter--) {
|
||||
fib += fibo_r(20);
|
||||
|
@ -3,7 +3,7 @@
|
||||
int main(void)
|
||||
{
|
||||
setbuf(stdout, NULL); /* to make it equivalent to the other versions, otherwise it caches */
|
||||
int counter = 100000;
|
||||
int counter = 10000;
|
||||
while(counter--) {
|
||||
printf("Hello there\n");
|
||||
}
|
||||
|
7
test/bench/c/loop.c
Normal file
7
test/bench/c/loop.c
Normal file
@ -0,0 +1,7 @@
|
||||
int main(void)
|
||||
{
|
||||
int counter = 1000000;
|
||||
while(counter) {
|
||||
counter -= 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user