Chrome V8 Creators: `with` and `delete` are “Dog Slow”

On a recent podcast the creators of Chrome’s V8 JavaScript Engine, Lars Bak and Kasper Lund, discussed some of the challenges of writing a JavaScript compiler. They cautioned that using with or delete is “dog slow”. When you use with, V8 has to wait until run time to resolve the scope chain. When you use delete V8 has to transform your object from a highly-optimized class structure into a slower hash table.

Lars and Kasper mentioned that with and delete likely have the same speed implications in other JavaScript engines.

So never use with or delete in a production application!

AJ O’Neal quotes Douglas Crockford saying that removing with from the language would speed things up significantly. It sounds like Douglas Crockford understands nature of JavaScript when it comes to compilers.

You can find the podcast on The discussion on with and delete is about from 13:33 through 16:50.