Soldato
Hi Guys,
I'd post this in programming but you lot probably already have the right set up to run this quickly. It won't blow up your computer or anything. You'll need to have a gcc installed.
Call it program.c
compile with
gcc -ansi -Wall program.c
and run with
./a.out
and if you could post the results here I'd appreciate it (only got access to one machine at the moment ). Should take less than a minute on a decent machine (that's why it took over two on this **** piece).
Thanks
Dstat
P.S. it's just comparing 3 ways of using an integer But I think I've got "speedstep" or whatever it's called ****ing it up on this laptop
#include <stdio.h>
#include <time.h>
#define NUM 2;
main(){
register int a = 2;
int b = 2;
time_t mytime = time(0);
int p[5] = {1,2,3,4,5};
int i=0;
int j=0;
time_t startTime = time(0);
for(j=0;j<900000000;j++){
for(i=1;i<5;i++){
p=p[i-1]*a;
}
}
time_t endTime = time(0);
printf("Testing registers\n");
printf("Start Time is %d \n",startTime);
printf("End Time is %d \n",endTime);
i=0;
j=0;
startTime = time(0);
for(j=0;j<900000000;j++){
for(i=1;i<5;i++){
p=p[i-1]*b;
}
}
endTime = time(0);
printf("Testing raw integer\n");
printf("Start Time is %d \n",startTime);
printf("End Time is %d \n",endTime);
i=0;
j=0;
startTime = time(0);
for(j=0;j<900000000;j++){
for(i=1;i<5;i++){
p=p[i-1]*NUM;
}
}
endTime = time(0);
printf("Testing DEFINED integer\n");
printf("Start Time is %d \n",startTime);
printf("End Time is %d \n",endTime);
}
I'd post this in programming but you lot probably already have the right set up to run this quickly. It won't blow up your computer or anything. You'll need to have a gcc installed.
Call it program.c
compile with
gcc -ansi -Wall program.c
and run with
./a.out
and if you could post the results here I'd appreciate it (only got access to one machine at the moment ). Should take less than a minute on a decent machine (that's why it took over two on this **** piece).
Thanks
Dstat
P.S. it's just comparing 3 ways of using an integer But I think I've got "speedstep" or whatever it's called ****ing it up on this laptop
#include <stdio.h>
#include <time.h>
#define NUM 2;
main(){
register int a = 2;
int b = 2;
time_t mytime = time(0);
int p[5] = {1,2,3,4,5};
int i=0;
int j=0;
time_t startTime = time(0);
for(j=0;j<900000000;j++){
for(i=1;i<5;i++){
p=p[i-1]*a;
}
}
time_t endTime = time(0);
printf("Testing registers\n");
printf("Start Time is %d \n",startTime);
printf("End Time is %d \n",endTime);
i=0;
j=0;
startTime = time(0);
for(j=0;j<900000000;j++){
for(i=1;i<5;i++){
p=p[i-1]*b;
}
}
endTime = time(0);
printf("Testing raw integer\n");
printf("Start Time is %d \n",startTime);
printf("End Time is %d \n",endTime);
i=0;
j=0;
startTime = time(0);
for(j=0;j<900000000;j++){
for(i=1;i<5;i++){
p=p[i-1]*NUM;
}
}
endTime = time(0);
printf("Testing DEFINED integer\n");
printf("Start Time is %d \n",startTime);
printf("End Time is %d \n",endTime);
}