Know Your Engines: How to Make Your JavaScript Fast

David Mandelin (Mozilla Corporation)
Web Performance Ballroom EFGH
Average rating: ****.
(4.29, 7 ratings)

In order to make their programs fast, developers need to understand how the system compiles, optimizes, and runs programs. This talk will help JavaScript developers make their programs fast by popping the hood on modern JavaScript engines such as SpiderMonkey, V8, JSC, and Chakra and explaining how they work.

The main part of the talk will explain how each major JavaScript language feature is compiled and run, how fast it is compared to other operations, and what “performance faults” can make it much slower than expected. For example, reading a property (x = o.p) is implemented by compiling a bit of code to get the property value very quickly for any object with the same properties. This means that if a given line of code reads a property always from objects that look the same, it is very fast; if it works on objects with different property sets, it is usually still fast; if it works on objects that don’t have that property, it will be very slow. I will avoid details that are interesting mainly to engine implementers in favor of giving concrete, intuitive models that developers can use to predict performance and understand performance problems.

In the second, shorter part, I’ll talk about current and future work to make JavaScript go faster, and what it might mean for developers. One area is advanced research-derived optimizations, such as tracing (TraceMonkey), dynamic type profiling (Crankshaft), and type inference. These technologies have the potential to dramatically speed up programs, but they will probably work much better on programs where values usually have the same type, so developers should know something about what kinds of programs benefit. Another area is simpler, more practical additions, such as web worker threads, which enable multithreading in browser JavaScript, and typed arrays, which allow fast computation on arrays of integers, including pixel data. The main goal of this part of the talk is to give developers ideas about what new things may be possible in JavaScript in the near future.

Photo of David Mandelin

David Mandelin

Mozilla Corporation

David Mandelin is a software engineer at Mozilla, where he spends his time making JavaScript run correctly and fast in Firefox. Previously, he has done work on static analysis, miscellaneous programming language research, business web application development, and random programming.

Comments on this page are now closed.


Picture of Sophia DeMartini
Sophia DeMartini
06/23/2011 1:06am PDT

Hi Tarun,

A .pdf version of David's presentation has now been uploaded.

Best, Sophia

Tarun Nainani
06/21/2011 8:47am PDT

Is it possible to post presentation in some other format for ex – pdf?

Picture of Skip Sauls
Skip Sauls
06/15/2011 10:50am PDT

Awesome session, and the type of information that every JavaScript developer should know. I’d like to see the JS engines provide “feedback” on what cannot be easily optimized, such as what isn’t type stable. Make this information available in a standardized format so that tools like Firebug, YSlow, etc. could analyze it, suggest optimizations, and so on. If one JS engine provided it, the others would surely follow given how competitive they all are. Everyone would benefit in the long run.

Anne Sullivan
06/15/2011 10:05am PDT

Wow, what a great talk! Really deep explanations of the inner workings of different JavaScript engines, and how that impacts the performance of the JS code you write. I can’t wait for the slides.

Picture of Steve Souders
Steve Souders
05/19/2011 8:09am PDT

Most of my performance best practices are found from a black box perspective. Then you hear someone like Mike Belshe or Eric Lawrence talk about performance from an inside perspective and it’s reveals a whole world you weren’t aware of. David will do that in this talk – revealing the inner workings of today’s JavaScript engines and the opportunities for better performance.

  • Keynote Systems
  • Cisco
  • Google
  • Neustar
  • Betfair
  • Cotendo
  • Rackspace Hosting
  • Akamai
  • Apica
  • dynaTrace
  • Equinix
  • Facebook
  • New Relic
  • Opscode
  • Yahoo! Inc.
  • AppDynamics
  • Aptimize
  • Blaze
  • CDNetworks
  • Cedexis
  • Citrix Systems
  • Compuware Corporation
  • Dyn Inc.
  • F5 Networks
  • Heroku
  • Percona
  • Quest Software
  • Schooner Information Technology
  • SiteSpect
  • Splunk
  • Strangeloop
  • WatchMouse
  • Zeus Technology
  • Neustar

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Yvonne Romaine at

Download the Velocity Sponsor/Exhibitor Prospectus

Contact Us

View a complete list of Velocity contacts