怎样说明cache的重要性?
我想到的思路是写一个小代码,来降低cache 的命中率,
通过比较运行时间和命中率来表现cache 的提速性能.
写了这么个代码:
#include<stdio.h>
int main(){
int a[1025][1025];
int num = 3;
const int max = 1024;
int i,j;
for(i=0; i<max; i++){
for(j=0; j<max; j++){
a[i][j] = num;
//a[j][i] = num;
}
}
printf("success running!");
return 0;
}
但是: 效果不是很好.
想问一下有没有什么办法可以很大降低cache的命中率?
或者
怎样说明计算机中cache的重要性