Javascript IF/Else and performance
Javascript IF/Else and performance
if/else语句会影响性能吗?
编辑:好吧,这是荒谬的
您的同事可能指的是,在某些情况下,每次分配一个变量比检查某些条件然后分配它要快。
var a = 2;
function slower() {
if (a !== 0)
a = 0;
}
function faster() {
a = 0;
}
说真的,考虑到今天的计算机有多么强大,考虑单个if
语句对性能的影响是相当荒谬的。
相关文章:
- Selenium WebDriver and JavaScript change
- PHP and Javascript functions
- Javascript Return and if/else
- SetTimeout and clearTimeout in Javascript
- lightbox in html 5 and javascript
- TimelineJS and AngularJS
- timeago.js with datatable and PHP
- javascript button ajax and php
- Ajax and Json with Rails
- Performance: NaCl vs Emscripten
- Combine onload, onresize and onclick
- php布尔值's小写AND大写和数字布尔值'可以接受
- setTimeout and V8
- Jquery post and onclick
- Moment js and IOS
- Rails 3.2 and Paloma gem
- Javascript and Performance
- SharePoint 2010 and iPad jQuery Performance
- Windows Phone 7 and IE DOM Performance
- Javascript IF/Else and performance