flat assembler
Message board for the users of flat assembler.

Index > Main > When should I replace push ... with pusha?

Author
Thread Post new topic Reply to topic
Victor Kindhart



Joined: 02 Feb 2015
Posts: 7
Victor Kindhart 17 Jun 2015, 14:53
The title says it all. When should I use pusha instead of push ..., push ... - I mean, when pusha gets faster than a couple of push instructions?
Post 17 Jun 2015, 14:53
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 17 Jun 2015, 15:14
Victor Kindhart wrote:
The title says it all. When should I use pusha instead of push ..., push ... - I mean, when pusha gets faster than a couple of push instructions?
That depends upon so many factors that we can't know the answer.

My guess is that for modern CPUs it makes no difference at all. And any difference it might make would likely be unmeasurable except in very specific circumstances.

Essentially, don't worry about it. If you have to ask then that means you can't perceive the difference, if any, anyway.
Post 17 Jun 2015, 15:14
View user's profile Send private message Visit poster's website Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 17 Jun 2015, 16:10
Hard to say - pusha would in first save code space and might save execution time as well as there is only one instruction to read but do to pipelining this might be without noticeable effect. Anyway it uses more stack space so if you don't need to save all registers it is better to select them.
Post 17 Jun 2015, 16:10
View user's profile Send private message Send e-mail 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.