Friday, October 12, 2012

Performance Tips for JavaScript in V8 (link)

It's important to indentify and understand how the V8 engine works with your code to prepare to build performant JavaScript. Once more, the basic advice is:

  • Be prepared before you have (or notice) a problem
  • Then, identify and understand the crux of your problem
  • Finally, fix what matters
This means you should ensure the problem is in your JavaScript, by using other tools like PageSpeed first; possibly reducing to to pure JavaScript (no DOM) before collecting metrics, and then use those metrics to locate bottlenecks and eliminate the important ones. Hopefully Daniel's talk (and this article) will help you understand better how V8 runs JavaScript - but be sure to focus on optimizing your own algorithms, too!