Divi slow to load?
1. Fewer files to request and smaller files are key.
Each plugin and theme is likely to introduce several CSS and JS files apiece. Plugins like AutoOptimize can consolidate the CSS into fewer files and it can do the same with JavaScript. Almost every web server is capable of serving out files compressed with GZip. Almost every web browser is capable of decoding GZipped files.
2. Move most of your Javascript to the footer.
The header is the best (except when it isn’t). When Javascript code goes into the header, that code executes first. It will block the display of content until the Javascript fully executes. This is called “render blocking.” From an end-user perspective this is horrible. They will be left with a white screen for much long than is ideal. Some code can always go into the footer: analytics code, helper code, code relevant to the lower sections of the page (eg. a dynamic footer).
3. Flush your content.
First, work with a child Divi theme custom to your site. Hang time is a killer when you’re waiting for a web page. PHP can wait for a good length of time before delivery. It is possible to urge it to begin earlier than otherwise, sending content back to your audience faster. I do this by putting the flush()
call at the top of the header.php file in the PHP code.
If you’re about to output the themed data, you’re ready to deliver content. Push it out as soon as you can, even starting the process before the page.tpl.php is populated and served. One thing to note: flushing content may not be a tactic that plays well with GZip.
4. Make content cacheable.
WordPress put query strings onto the tail end of some URLs and change that string with each load to provide a fresh load of that image, script or styling. From an end user perspective, that takes a lot of time to re-fetch.
Use a plugin like Far Future Headers to change the Expiry date (it’s a meta data setting in the served assets) to push it days or even months into the future. That lets a web browser shoulder some of the load and keep copies of those elements on the user’s computer instead of downloading them new with each page load.
Additional Tips:
- Deactivate and delete unused plugins. If the site can thrive without a given plugin, take it out.
- Put a CDN (Content Delivery Network) between your server and your audience.
- Run PHP 7.3 or higher. PHP has improved. Use that new improved version of PHP.
- Choose a speedy, stable web host. My favourite is A2 Hosting.