开发者

Are there any performance disadvantages of using .if and .elseif in assembly?

I was wondering if t开发者_Python百科he .if and the .elseif directives had any performance disadvantages when compared to using a series of cmp and jmp statements.

Thanks!

Devjeet


In general, there is no performance disadvantage.

However, if you decide to use them all the time, you should probably check the assembler generated every once in a while to better understand what they are doing to your code. There may be rare instances the produced code is slightly less efficient.


You are more probable to write a worse .if yourself actually. For instance, ".IF eax==0" is evaluated as :

test    eax,eax
jnz     label

it can't get better than this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜