Page “weight” refers to the overall size of a particular web page, including files like HTML, CSS style sheets, images, and scripts. A “heavier” site loaded with high-res images and videos will generally run slower if not optimized correctly.
According to web performance expert Tammy Everts, 1MB is the ideal size for fast-loading web pages. To get us there, we’ll need to take stock of what elements we can afford to trim and how to minimize file size.
Load Order
The order in which you load page elements also impacts page speed. Browsers normally load synchronously, meaning each element is loaded one at a time. While it might seem efficient, the system can get jammed up if it encounters a large file. An easy solution is asynchronous loading. Asynchronous loading allows your browser to load more than one element at a time. It prevents your browser from getting caught up downloading large files, like JavaScript, which tend to load the slowest (and why we recommend staying away from JavaScript if possible). You can also choose to defer loading on certain files. This ensures that the rest of the page loads without delay before tackling the larger files. To see a full list of files, HTTP requests, and your page’s load order, right-click on your page and click Inspect. Then click on the “Network” tab.Third-Party Scripts
Hosting too many third-party scripts can also slow down page speed. You’ll want to inspect which third-party scripts are running on your page and determine whether you really need that site tracker or Vimeo embed. You can use Google PageSpeed Insights to get a list of third-party scripts featured on your site.Lazy Loading
If your page needs to contain lots of photos, you can apply lazy loading through JavaScript. Lazy loading allows you to load only images that are “above the fold” on your page. Once a user scrolls down the page, the additional images load as needed. Lazy loading speeds up your page speed by allowing your page to load a little bit at a time rather than taking on a massive load of data all at once. WordPress offers nearly a dozen different plug-ins to easily enable lazy loading for websites. The most popular plug-ins include a3 Lazy Load and Lazy Load, along with Lazy Load For Videos, which works specifically with video content. There’s also Google’s native lazy load, which allows for lazy loading through Chrome browsers versions 76 and later. For sites not run on WordPress, Google offers a sample implementation for direct lazy loading and tips for fixing lazy loaded content.Text & Code
According to Yahoo, 80% of a site’s load time is spent downloading elements like CSS style sheets, images, and scripts. For every one of these elements, an HTTP request needs to be made, with each request taking up the user’s precious time. You can reduce the number of requests by “minifying” your HTML, CSS, and JavaScript files. Minifying reduces the size and amount of your files by combining redundant files and removing unnecessary formatting, whitespace, and code. Best of all, the minification process does not affect how browsers process the page. The following tools will help you minify your files:- HTML Minifier (HTML)
- CSS Nano (CSS)
- Uglify.js (JavaScript)