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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.