C code optimization benchmark

Can you believe that the code above can be optimized to run 14 times faster on Intel Core i7 CPU and to run 40 times faster on AMD Athlon X2?


#define X_SIZE 60
#define Y_SIZE 30
int matrix[X_SIZE][Y_SIZE];
void initmatrix(void)
{
int x,y;
for (x = 0; x < X_SIZE; ++x){
for (y = 0; y < Y_SIZE; ++y){
matrix[x][y] = -1;
}
}
}
void main()
{
initmatrix();
}

Popular posts from this blog

Adding a serial console to the Buffalo Air Station WZR-1750DHP

How to tell rpmbuild the number of simultaneous jobs? (make -j)

Buffalo WZR-1750DHP + OpenWRT