Is if (a < 101) faster than if (a <= 100) , Please explain for javascript and php seperately ?
I edited some code in javascript file
Initial Code
rect.top>=0&&rect.left>=0&&rect.top<=(window.innerHeight||document.documentElement.clientHeight)
After edit code
rect.top>-1&&rect.left>-1&&rect.top<=(window.innerHeight||document.documentElement.clientHeight)
But my seniour says it will not make it fast. So please help.
CodePudding user response:
No. It is not faster. Within the microcode of every thinkable CPU, the two comparisons >
and >=
translate to the same-length instruction. It would not depend on the programming language used.