Which one is better/faster/preferred
1:
mov eax, 5
push eax
mov eax, [someAddress]
push eax
2:
push 5
push [someAddress]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
#2 is faster because the assembly operation can take a constant, so you avoid the time loading the eax register. Also #2 leaves eax free, which is good if you are holding many values in registers as it can help minimize memory accesses. If you know the values are constants, just use #2.