Why DOM manipulation is slow?

Actually, the DOM is not slow. Adding or removing a DOM node is not much more than setting a property on the JS object. However, layout is slow. Imagine adding a DOM node changes the height of the document, it would invoke a bunch of rendering processes to redraw the screen. And all the complex algorithms behind the those processes makes any changes in DOM potentially expensive.

Mentioned in
sticker #3
Subscribe to Dwarves Memo

Receive the latest updates directly to your inbox.