3 ms·
JavaScript downloading and parsing is much more computationally expensive than html parsing. The DOM seems slow, I think mostly because it requires translating
by timw4mail 6y ago
JavaScript downloading and parsing is much more computationally expensive than html parsing.
The DOM seems slow, I think mostly because it requires translating between rendering systems - the representation of the html has to be updated, the styling has to be applied, and the change has to be painted on screen. This explains why updating a documentFragment as a batch operation is much faster than changing the dom directly in a loop.