Monday 27 June 2016

Speed Up your JavaScript

  • Change DOM by CSS Class not actual CSS
  • Avoid deep arrays
  • Don't touch DOM every time
  • Avoid for-in loop
  • Use Async as much as possible
  • Objects and arrays both are much slower then variables, so use var as much as possible
  • GET JSON instead of HTML view
  • Use Closures
  • When using loop try to combine control condition and variables as it speeds up the iteration
  • Make use of scope to create reusable objects and components
  • Use native JS as much as possible