
As time goes by, the Internet becomes faster, and user devices become more mobile. Practitioners that were relevant 5-10 years ago are becoming obsolete, and they are being replaced by new ones. For 9 years of existence of WEBO Group (WEBO Site Speedup, webo.in, webopulsar.ru, Ayri.rf) we have analyzed, increased and promoted the speed of hundreds of thousands of sites. Over the years, browsers have become faster, and sites - more difficult. And every year approaches to accelerate sites have changed a bit. I reviewed the most common problems of site speed and the most effective methods to solve them today.
Disclaimer: all tips are harmful, they do not need to be applied!
1. Disable compression (gzip)
Back in 2008, a study showed
exactly how gzip compression speeds up websites . But now the bandwidths of the channels are significantly higher than the claimed 1500 Kb, and mobile processors are at the level of computers 10 years old. Therefore, the overhead on unarchiving (reverse gzip) outweighs the gain from saving time on data transfer.
Urgently disable gzip on sites!')
2. Alternate styles and scripts
Modern browsers can download files in several streams, and then apply them to an HTML document. To optimize load time, you can alternate loading styles and scripts, for example, like this:
<link rel = stylesheet media = all href = "/ media / css / admin / styles.css">
<script type = "text / javascript" src = "/ media / js / admin / header.pkg.js"> </ script>
<link rel = stylesheet media = all href = "/ media / css / admin / icons.css">
<script type = "text / javascript" src = "/ media / js / admin / app.pkg.js"> </ script>
...
How it will work: while the browser loads the second file (scripts), it will be able to render the first file (styles), and then through the list. You can save time loading all files by rendering (parsing) the previous ones!
3. Load counters at the top.
The following practice has developed - to insert counters and third-party widgets at the bottom of the page, ostensibly to prevent blocking of loading. In fact, preloading third-party widgets from the very beginning of the document allows you to parallelize the download and use the user's channel in the most efficient way. Appealing to a domain other than the site's domain causes an additional DNS request. At this time, the browser is “idle”, and could download valuable information from your domain.
Insert
all third-party scripts at the very beginning of the document - this is how you parallelize the data loading as much as possible.
4. Create a separate subdomain for each resource.
All browsers have a limit of 10 parallel requests to a single domain (not the server). To maximize the utilization of the data transmission channel, it is necessary to parallelize the requests. You can divide them into groups of 10, and you can download each style, script, font, image from its subdomain. This is somewhat difficult to configure, and will have to refine the content management system, but the result will exceed all expectations.
Here -
detailed instructions and rationale for the use of multiple domains .
5. Do not optimize images.
Any optimization of images changes their structure and binary representation. For JPEG files, this can lead to a violation of the original Huffman tables (lower image quality), for PNG files - to various "third-party" effects (for example, loss of transparency or distortion of the color palette on some devices).
If you want to be sure of the quality of the images - never optimize them. And best of all - use the BMP format on websites: it guarantees the transfer of all information without loss.
6. Use tables in layout
CSS standards create all the prerequisites for an easy and semantic page layout. But the implementation of the standard in browsers does not always support these prerequisites. And quite often the special features of CSS3 (for example, gradients or shadows) lead to a significant slowdown of the page display. There are also problems with a large number of nested blocks that have relative (or floating) positioning and complex selectors (
pruflink 1 ,
pruflink 2 ,
pruflink 3 ).
Only tables can provide cosmic speed and stability of the page display on all devices. This is a long-forgotten practice of typesetting, but it is time to give it a second wind. Did you wonder why even today e-mail lists use tables everywhere? Behind them the future!
7. Avoid optimizing styles or scripts.
Optimizing CSS or JavaScript files
gives no more than 15% of the gain in size, but it can lead to problems that are difficult to track in the layout or execution (for example, when changing the order of selectors or deleting unused variables from scripts). Refusing to minimize text files will allow you to also debug all development problems right on the site itself, without restoring the original, non-minimized versions of the files.
If suddenly you use any modules of the control system to merge and compress files - turn them off. The modules create dynamic code for combining files, and this code additionally loads the hosting and spends its resources.
8. Disable file caching.
As the practice of optimizing websites over the past 10 years has shown, caching files in the browser is a difficult-to-manage and ambiguous mechanism. You can never be completely sure that the browser shows exactly the files that are uploaded to the hosting. If you want your users to always see exactly your site (and not its old version), then you need to disable caching of static files.
This is done in two stages: you need to disable unconditional caching (Expires and Cache-Control headers) and conditional (ETag and Last-Modified headers). Turning off caching will also allow the search engines to get the most up-to-date version of your site, and not some old stuff (learn
more about turning off caching ).