Hey peeps, a quick assembly question (x86!!)
According to x86 docs a read/write to memory takes 1 cycle (given that the thing being read is in cache)
My question is, if I have to save a register on a stack, would it be faster to to use a temporary int memory location all over my program for this purpose?
a push takes 1 cycle
a pop takes like 4 cycles
but a read/write to memory location takes 1+1 = 2
So over my code would it be faster to go:
mov TEMP, ecx;
call runPerfectNesEmulator;
mov ecx, TEMP;
vs
push ecx;
call runPerfectNesEmulator;
pop ecx;
The math adds up?
According to x86 docs a read/write to memory takes 1 cycle (given that the thing being read is in cache)
My question is, if I have to save a register on a stack, would it be faster to to use a temporary int memory location all over my program for this purpose?
a push takes 1 cycle
a pop takes like 4 cycles
but a read/write to memory location takes 1+1 = 2
So over my code would it be faster to go:
mov TEMP, ecx;
call runPerfectNesEmulator;
mov ecx, TEMP;
vs
push ecx;
call runPerfectNesEmulator;
pop ecx;
The math adds up?