flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > which instruction is quicker?

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 10 Jul 2018, 09:50
which instruction is quicker?
Code:
cmp eax,[0x12345678]    

or
Code:
cmp [0x12345678],eax    

_________________
smaller is better
Post 10 Jul 2018, 09:50
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 10 Jul 2018, 18:13
CandyMan wrote:
which instruction is quicker?
Code:
cmp eax,[0x12345678]    

or
Code:
cmp [0x12345678],eax    

It should be measured but since they differ in a single bit (direction bit) and are converted to a set of RISCy micro-ops by the processor, I guess, the two are equal in speed. For quite strict definitions of equality.
Post 10 Jul 2018, 18:13
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20526
Location: In your JS exploiting you and your system
revolution 11 Jul 2018, 01:08
Measure it. Do you see any difference? If it it really important for you to know which is "quickest" then you will need to measure both variants in your production code to determine which variant works for you.

Other people here could run some test code on their systems, but this is unlikely to give you any useful information about what will happen in your code on your systems.
Post 11 Jul 2018, 01:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.