void sub(){
int stack_dynamic1[A][A];
int stack_dynamic2[A][A];
int stack_dynamic3[A][A];
static int static_local1[A][A];
static int static_local2[A][A];
static int static_local3[A][A]; ...


이렇게 정의하면 stack_배열은 스택에저장, static_배열은 힙에저장되잖아요
이떄 각 배열에 접근할 때 스택은 SP레지스터 읽어서 offset만큼 덧셈 op 한번에 주소계산,
static은 GP + offset해서 한번에 주소 계산하기때문에
두 방법을 사용했을 때 시간이 같아야 정상 아닌가요
왜 스택이 빠를까요 혹시 놓친 부분이 있을까요

전체 코드 입니다
#include <iostream>
#include <random>
#include <ctime>

#define A 200

void sub(){
int stack_dynamic1[A][A];
int stack_dynamic2[A][A];
int stack_dynamic3[A][A];
static int static_local1[A][A];
static int static_local2[A][A];
static int static_local3[A][A];


std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dist(1, 100);
for(int i = 0; i<A; i++){
for(int j = 0; j<A; j++){
stack_dynamic1[i][j] = dist(gen); //stack
stack_dynamic2[i][j] = dist(gen); //stack
stack_dynamic3[i][j] = 0;
}
}

for(int i = 0; i<A; i++){
for(int j = 0; j<A; j++){
static_local1[i][j] = dist(gen); //static
static_local2[i][j] = dist(gen); //static
static_local3[i][j] = 0;
}
}
clock_t start;
clock_t end;

start = clock();
for(int re = 0; re < A; re++){
for(int a = 0; a<A; a++){
for(int b = 0; b<A; b++){
for(int i = 0; i<A; i++){
stack_dynamic3[a][b] += stack_dynamic1[a][i]*stack_dynamic2[i][b];
}
}
}
}
end = clock();
std::cout << "Stack-dynamic matrix multiply time: " << (double)(end - start) / CLOCKS_PER_SEC << " seconds" << std::endl;

start = clock();
for(int re = 0; re<A; re++){
for(int a = 0; a<A; a++){
for(int b = 0; b<A; b++){
for(int i = 0; i<A; i++){
static_local3[a][b] += static_local1[a][i]*static_local2[i][b];
}
}
}
}
end = clock();

std::cout << "Static matrix multiply time: " << (double)(end - start) / CLOCKS_PER_SEC << " seconds" << std::endl;

}

int main(void){
sub();
return 0;
}
전체