Help and documentation
Speed Medium impact Medium depends on the cause
DOM size
Too many HTML elements slow down rendering.
What it is
The DOM is the tree of a page's HTML elements. A DOM that's too large or deeply nested (thousands of nodes) slows down rendering, layout, and JavaScript operations.
Why it matters
A large DOM increases memory and CPU usage and worsens interactivity and smoothness, especially on mobile. It tends to be a symptom of bloated templates or redundant wrappers.
How to do it
- 1Simplify the structure: remove unnecessary <div> wrappers.
- 2For long lists/tables, use pagination or virtualization.
- 3Don't load hidden content that isn't needed (render on demand).
Conclusion
A lean DOM renders and responds faster. As a rough guide, keep the node count in the low thousands and avoid deep nesting. For data-rich pages, list virtualization helps.
Related topics