Tip1
define local variables
When any variable is referenced, Javascript looks it up by looping through different members of the set of variables. The deeper the engine has to look for a variable in this scope chain, the longer it will take. The search starts with the local variables and then moves to the global variables.Therefore it’s always better to redefine global variables locally.
Tip2
Do not use with() statement
with() statement gives local variables the performance drawbacks of global ones, but in return it derails Javascript optimization. with() appends extra set of variables to the beginning of the scope chain. So anytime a variable is called, the Javascript engine has to loop through the with() variables, then goes to the local variables, and then the global variables.
Boosting Javascript Performance Tips
Tip1
define local variables
When any variable is referenced, Javascript looks it up by looping through...
boosting javascript performance tips
Also tagged with one or more of these keywords: boosting, javascript, performance tips
Web Design →
Javascript →
Comparing Strings in JavaScriptStarted by Salwa, 18 Jul 2013 comparing strings, javascript |
|
|
||
Web Design →
Javascript →
Using OnSubmit in JavaScriptStarted by Salwa, 18 Jul 2013 javascript, onsubmit event |
|
|
||
Web Design →
Javascript →
Downloading Javascript to iPodStarted by OneDes, 13 Jun 2013 downloading, javascript, to ipod |
|
|
||
Web Design →
Javascript →
Downloading JavaScript to BlackBerryStarted by OneDes, 13 Jun 2013 downloading, javascript and 1 more... |
|
|
||
Web Design →
Javascript →
Enabling JavaScript on a MacStarted by OneDes, 13 Jun 2013 enable, javascript, mac |
|
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users