There is great interest in page speed, because
this feature of the site is directly involved in determining the user experience. Also,
in a direct or indirect way it is seriously taken into account by the Google algorithm. Now, loading speed depends on a myriad of
technological factors, but I would still like to give you the set of methods which I generally
apply. First of all, what is a good loading speed? Google loves the TTFB (Time To First Byte),
which corresponds to the time required to get the first byte since the user’s browser
makes a request to the server. Best practices set this optimal value to a maximum of 0.2
seconds. As you may have noticed, this is a value very
different from the total loading time of the page, because it only refers to the responsiveness
of the server. Obviously Google also considers the rest, because that is what is directly
involved in the user experience. For a total page loading time, you can use
online measurement tools, such as Pingdom ⁽¹⁸⁾ or GTmetrix ⁽ ¹⁹⁾ (rendering
included). In my sites I tend to stay in the range of
1-2 seconds, considering these elements: Server response to show the page
Favicon Iframe (for example, YouTube video)
Now, let’s see in practice what are the most useful tasks to speed up a site, considering
that some will be particularly technical, while others are for everyone. Gzip compression : reduces the size of HTML
file of your hosting. Images : compress the files with external
software like TinyPNG or apply the practice of Lazy Loading.
Minification : removing spaces, commas and other useless characters from style sheets,
free tools or WordPress plugins like WP Fastest Cache.
Browser cache : by visiting 10 or 20 pages, the user’s browser can download the JS and
CSS files locally in order to not having to continually request them from the server.
In order to enable this functionality, you will need to enter a specific code in the
.htaccess file of your hosting. Server cache : I refer to Varnish, WordPress
plugin like CometCache or other server side solutions to save every page and make it immediately
available to the user when it gets requested, without having to continually generate it
from scratch. Multiple redirects : I often see some pages
with a series of 301 redirects, but you need to know that, in addition to diluting the
link juice, they take time and the sum of all these times can result in a long unjustified
wait for the user. Type of server : based on the number of visitors
and the type of content, you can do all the optimizations you want, but a shared hosting
could still be inadequate and you will need to switch to a VPS or even a dedicated server
with exclusive resources to better manage the requests of your visitors.
Technology : it is evident that using WordPress, Joomla or other CMS will be much heavier than
a pure HTML site in terms of loading time. The architecture choice has a significant
impact on response times, regardless of the type of server you have.
Updates : technology advances and new versions tend to be optimized.
For example, in a recent benchmark made by Kinsta.com ⁽²⁰⁾ it has been verified
that with WordPress 5, having PHP 7.3 offered significantly better performance (253.2 requests
per second) compared to the classic PHP 5.6 (91.64 requests per second), which is still
used in many servers. Obviously, we need to evaluate the deprecated
functions and compatibility of plugins or other scripts, but it is certainly worth considering. So far we have seen technical optimizations,
which should be done only at the end, but we have other equally effective implementations
to apply from the beginning of the project. Light themes : when you choose graphics, you
should opt for a small and fast loading template, otherwise you’ll have a hard life trying to
optimize it later. Limit the plugins : if you use WordPress,
from the beginning you should try to activate only the plugins that you really need or you
can merge them together. For example, instead of using 3 plugins for social share functionalities,
just check if there is only one that already does everything.
Restrict media : it is important to use images or multimedia content in the pages, but it
is equally important not to overdo it. For example, including 50 photos in a “solar panel”
post is obviously excessive and would only slow down the page loading. The same goes
for YouTube video embeds, since uploading 20 videos on one page doesn’t make much sense.
Remove unnecessary dependencies : when you remove some features from the template you
just bought, it happens to still have references to CSS and JS files, which only take up resources
and slow down loading time. In this case, you should proceed to remove them from the
HTML code. Here is an example of a test using the Pingdom
tool (from the London server), targeting one of my blogs in the shopping sector with about
2000 articles, after performing all the optimizations described in this chapter.