开发者

Time-consuming operation

if I have two integer variables with allocated memory and value a and b, which 开发者_StackOverflow中文版is the more time consuming (time of execution by the processor) operation: comparison (a == b) or assignment (a = b) ? And why?


It probably depends on your processor architecture and the resulting binary executable.


Because the assignment involves a memory write (assuming that a is not a local value held in a register), chances are that it is slower on contemporary processors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜