How to resolve Uses An Excessive DOM Size issue in Google pagespeed insights

18,316

The non technical answer would be to minimize your WordPress website DOM size is by loading fewer resources to reduce the DOM size and you can do that by many way such as:

  • Reducing unnecessary plugin.
  • Reducing uncessary css/js.
  • Redcuing number of images. Basically If you think something can be removed from the page do it and you will see lesser number of nodes in your DOM.

Technical feedback (adding from Google pagespeed recommendation) :

A large DOM tree can harm your page performance in multiple ways.

Network efficiency and load performance. If you server ships a large DOM tree, you may be shipping lots of unnecessary bytes. This can also slow down page load time, because the browser may be parsing lots of nodes that aren't even displayed above-the-fold. Runtime performance. As users and scripts interact with your page, the browser must constantly re-compute the position and styling of nodes. A large DOM tree in combination with complicated style rules can severely slow down rendering. Memory performance. If you use general query selectors such as document.querySelectorAll('li') you may be unknowingly storing references to a very large number of nodes, which can overwhelm the memory capabilities of your users' devices. Recommendations An optimal DOM tree:

Has less than 1500 nodes total. Has a maximum depth of 32 nodes. Has no parent node with more than 60 child nodes.

Share:
18,316
Hiran Narayanan
Author by

Hiran Narayanan

Updated on June 14, 2022

Comments

  • Hiran Narayanan
    Hiran Narayanan about 2 years

    Avoid an excessive DOM size issue is showing in Google Pagespeed Insights results. How can i resolve this ? Please mention the ways to reduce it. My website is a wordpress website.

  • Alex Stephens
    Alex Stephens over 4 years
    for website builders you could use yoodu.co.uk , their pages are very light and fast. In fact built for speed.
  • Dale Ryan
    Dale Ryan over 2 years
    I don't get why people disliked this answer. This is the most effective advice. Widgets usually have a large DOM count and child nodes. Consider having a card grid widget with 10 items inside and each card constitutes to the total DOM count of the whole page. You can either decrease the number of items being shown or tweak the card template and move classes or remove unnecessary div tags. By removing 5 unnecessary div element for example reduces DOM count by 50 since we have 10 cards on the grid.