English 中文(简体)
比较操作员业绩(>、>=、<=>)
原标题:Comparison operator performance (>, >=, <, <=)

如果要比较两个分类账,经营者是否会对进行比较所需时间产生影响? 例如:

if (x < 60)

以及

if (x <= 59)

哪一个能够提供最佳业绩,或者业绩差异会忽略不计? 业绩成果取决于语言吗?

我常常发现,我把使用这些经营者混为一谈。 任何想法都会受到赞赏。

最佳回答

即便存在明显差异,我认为汇编者也有足够的智慧来照顾这些事情。 因此,我的建议是利用使《守则》更容易理解的内容,并将微观开发方法留给汇编者。

问题回答

In the specific example you gave where one side is constant, I d expect an optimizer to transform one to the other if it was significantly faster.

差异微不足道。 从理论上讲,他们可以依赖语言。

正如另一个答复所述,这些答复在理论上也依赖于平台。

。 不平等经营者是否比平等经营者更快?

There is almost certainly no difference in performance. For CISC processors, you ll typically have all manner of branch instructions that cope with all the difference < <= > >= etc. On RISC there may be a very small performance difference although I d seriously doubt it!





相关问题
Find the closest time from a list of times

So, here s the scenario. I have a file with a created time, and I want to choose a time from a list of times that that file s created time is closest or equal too...what would be the best way to ...

PHP Comparison Operators and Data Types

I m currently working through O Reilly s "Programming PHP" and have come across this table titled "Type of comparison performed by the comparison operators": First Operand | Second ...

Loop Until Condition Reached, iPhone

I have a problem here... After a button is pressed I want a loop to run until a condition is reached: - (IBAction)buttonclick1 ... if ((value2ForIf - valueForIf) >= 3) { ... I would like a loop ...

nuSoap or Zend Soap? [closed]

I would like to know the differences between nusoap and ZendSoap, which is the best? what benefits and disadvantages of each? Anyone who has used both technologies could make this comparison? Thank ...

Logic for a file compare

I trying to write a programm for file compare. For example: file1 1 2 3 4 5 file2 1 2 @ 3 4 5 If I do it line by line, I get: 1 == 1; 2 == 2; 3 != @; 4 != 3; 5 != 4; != 5; But, the truth is ...

热门标签