flat assembler
Message board for the users of flat assembler.

Index > Main > MOVS and CMPS Performance question

Author
Thread Post new topic Reply to topic
JasonDamisch



Joined: 23 Dec 2014
Posts: 1
JasonDamisch
I have some familiarity with 68K and 6502 Assembly, and not much with Intel assembly. So, my question is this. What is the performance advantages of using Intel string instructions such as MOVS and CMPS as compared with just for instance writing a character with MOV in a simple loop?

My brief investigation into the subject via Google has shown me contradictory answers to this question.

Thank you for sharing your knowledge.

Jason
Post 23 Dec 2014, 21:05
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
I don't know, I've always used a byte-wise comparison and mov.

I've never tried those, so I'd be interested in hearing what others have done.
Post 23 Dec 2014, 21:45
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
You should be able to use both, and if you need more speed in a performance critical section, you can try to not use the string instructions. Intel has not bothered to made these instructions fast, although that may have changed with the newer processors.
I recently encountered a speed boost on ivy bridge by changing stosq to mov dword[rdi],eax; lea rdi,[rdi+8], but this may mean nothing for your needs.
Bottom line: try both and see which one is faster for you.
Post 23 Dec 2014, 22:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
Don't guess, measure.
Post 24 Dec 2014, 00:13
View user's profile Send private message Visit poster's website Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
revolution wrote:
Don't guess, measure.


Smile Empirical evidence always wins, yo!
Post 24 Dec 2014, 01:09
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
one more thing, 68K != modern intel/amd processor. Completely different ball games.
Post 24 Dec 2014, 03:33
View user's profile Send private message 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-2020, Tomasz Grysztar.

Powered by rwasa.