Created
April 16, 2017 12:40
-
-
Save n-eq/a976efd601fc45320f2c9a6e6141d5f6 to your computer and use it in GitHub Desktop.
Cache illustration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define N 2000 | |
#define M 1000 | |
int t[M][M] = {{0}}; | |
int main(){ | |
for (int i = 0; i < N; i++) | |
// swap the two lines to observe the effect | |
for (int j = 0; j < M; j++) | |
for (int k = 0; k < M; k++){ | |
// printf("t[%d][%d] @ %p\n", j, k, &(t[j][k])); | |
t[j][k] = k + j; | |
} | |
return EXIT_SUCCESS; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results: