I'm wondering if the following
mov eax, [ebx+4]
is equivalent to
add ebx, 4
mov eax, [ebx]
is there a performance improvement or a reason why the first should be preferred over the latter, except for a readability and code styling issue?
Although "equivalent", there are differences as noted below and there are several reasons to prefer the mov eax,[ebx+4]
over the add, mov
:
ebx+4
is performed "for free" by the address calculation logic in the CPU