参数的堆栈推入方法是否会影响功能性能? [英] Does parameters' stack pushing methods influence the functions performance?

查看:57
本文介绍了参数的堆栈推入方法是否会影响功能性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将函数的参数压入堆栈的方式对函数的性能有影响吗?
例如,__ stdcall将参数从右向左推送,而PASCAL将参数从左向右推送.当函数的方法从__stdcall切换到PASCAL时,函数的性能会改变吗?
假设,如果参数为(a,b,c,d ...,z),并且在函数中我比其他情况更频繁地使用参数(a),则__stdcall是否比PASCAL更好?如果方法是PASCAL,是否要在我要使用(a)时弹出所有其他参数(b-z),然后应再次推入(b-z)?
如果是这样,是否表示我在编写函数以提高其性能时应该关注参数的顺序?

Does the way in which the funtion''s parameters are pushed in stack matters to the performance of the function?
For example, __stdcall pushes the parameters from right to left, and PASCAL pushes them from left to right. Will a function''s performance change when the function''s method is switched from __stdcall to PASCAL?
Assume that, if the parameters are (a,b,c,d...,z), and in the function I use parameter (a) very more often than others, is the __stdcall better than PASCAL? If the method is PASCAL,is it that I''ll have to pop out all the other parameters(b-z) when I''m gonna use (a), and then (b-z) should be pushed in again?
If so, does it mean that I should concern about the sequence of the parameters when I''m writing a function to improve its performance?

推荐答案

通常来说,这应该没关系.堆栈体系结构允许您直接寻址参数,因此任何参数的访问时间都相同.也就是说,您不需要将它们从堆栈中弹出就可以访问它们.
Generally speaking this should not matter. The stack architecture allows you to address parameters directly so the access time is the same for any parameter; i.e. you do not need to pop them off the stack to access them.


这篇关于参数的堆栈推入方法是否会影响功能性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆