Jump to content

  • Free consultations and support
  • Live chatClick Here for Live Chat
  • Call ico 1888-906-1888
    Phone support: Open

    Ready for your call :)

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams

    Phone support: Closed

    We are back in: 1h 20m

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams


Boosting Javascript Performance Tips

boosting javascript performance tips

  • Please log in to reply
 

#1 SmartWeb

SmartWeb

    Senior Member

  • Designer
  • 271 posts

Posted 31 July 2012 - 09:01 PM

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.





Also tagged with one or more of these keywords: boosting, javascript, performance tips

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users