Lessons
-
Introduction
-
SEO
- Broken links
- Site map
- Semantic markup
- Robots.txt
- References
- Text
- Duplicates
- Basic
- Pictures
-
Speed
-
Minification
-
Minification of CSS to reduce its volume
Minification of the embedded JavaScript code of the page
Minification of the embedded CSS code of the page
Minification of images without loss of quality
Minification of JavaScript files to reduce its volume
Unused CSS code
Data optimization:Image URLs
Animated image format MP4, WEBM, SVG instead of GIF and WEBP
Unused JavaScript code
Using the WebP format in images
Too high-quality images without using compression
Suitable video bitrate
-
Reducing requests
-
An overabundance of small pictures
Grouping CSS files
Grouping JavaScript files
An overabundance of font files
Availability of end-to-end CSS, JS files
The presence of a monochrome font
Uploading duplicate files
Using JavaScript facades
Redirecting JavaScript code
Adding lazy loading
Redirect from/to www version
- Fonts
- Loading time
- Server Settings
- Pictures
-
The first content
-
The sequence of connecting JavaScript files
Font display mode
Setting up a pre-connection
Removing lazy loading
Long JavaScript code execution time
File upload delayed or on demand
The server is located in the same country where the users of the site live
No requests to another country that cause page loading to be blocked
-
Minification
-
Mobility
-
Screen support
-
Adapting the layout to a Full HD computer monitor
Adapting the layout for a horizontal tablet
Adapting the layout for a horizontal phone
Screenshots for the mini-report
How blocks break the page layout
Adapting the layout to an HD computer monitor
Adapting the layout for a vertical tablet
Adapting the layout for a vertical phone
- Comfort
-
Screen support
- Bugs
-
Convenience
- Social networks
- Web Application Manifest
- Favicons
- Basic
- Text readability
-
Vulnerabilities
- Encrypted connection
- Exploits
- Vulnerabilities
An overabundance of small pictures
To download a file, the browser spends time on service operations: establishing a connection, sending a request, receiving a response, closing a connection. This time is constant and does not depend on the speed of the Internet connection. For example, with a very fast Internet connection, it will take 1 millisecond to download the contents of the file, and up to 100 for service operations. The execution time of service operations depends on the network latency — ping, and not on the speed of the Internet connection.
To speed up the site, programmers group many small icons into one large file. This is usually a CSS or HTML file. This is done using data url technology.
Here are examples of the data url of a 1-by-1 pixel PNG image.
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P4DwQACfsD/Z8fLAAAAAAASUVORK5CYII=">
.element {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P4DwQACfsD/Z8fLAAAAAAASUVORK5CYII=)
}
You can convert any file to data url. [Conversion service](https://datauri.ai /) files.
Below is an example of how the download speed changes if the icons are not uploaded as a separate file, but transferred to HTML code as a data url.
<?php
$mode = $_GET['mode'] ?? '';
$base64 = 'data:image/png;base64,'.base64_encode(file_get_contents('icon-64.png'));
?><!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.btn {
color: #000;
text-decoration: none;
padding: 5px 10px;
border: 1px solid #000;
border-radius: 5px;
}
.btn:hover {
background-color: #ddd;
}
.btn.active {
background-color: #000;
color: #fff;
}
</style>
<script>
window.addEventListener("load", (event) => {
document.querySelector('#page-load').innerHTML = 'Страница загрузилась (событие window.onload) за <b>'+(performance.now()/1000)+'с</b>.';
});
</script>
</head>
<body style="font-family: sans-serif;">
Режим: <a class="btn <?=$mode === '' ? 'active' : ''?>" href="./icons_count.php">Иконки файлами</a> <a class="btn <?=$mode === '64' ? 'active' : ''?>" href="./icons_count.php?mode=64">Иконки base64</a>
<p>На странице 100 иконок.</p>
<p id="page-load">Тут отобразится время загрузки страницы (вызова события window.onload)</p>
<?php for($i = 0; $i < 100;++$i) { ?>
<img src="<?=$mode === '64' ? $base64 : './icon-64.png?t='.microtime(true).'.'.$i ?>" />
<?php } ?>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.btn {
color: #000;
text-decoration: none;
padding: 5px 10px;
border: 1px solid #000;
border-radius: 5px;
}
.btn:hover {
background-color: #ddd;
}
.btn.active {
background-color: #000;
color: #fff;
}
</style>
<script>
window.addEventListener("load", (event) => {
document.querySelector('#page-load').innerHTML = 'Страница загрузилась (событие window.onload) за <b>'+(performance.now()/1000)+'с</b>.';
});
</script>
</head>
<body style="font-family: sans-serif;">
Режим: <a class="btn active" href="./icons_count.php">Иконки файлами</a> <a class="btn " href="./icons_count.php?mode=64">Иконки base64</a>
<p>На странице 100 иконок.</p>
<p id="page-load">Тут отобразится время загрузки страницы (вызова события window.onload)</p>
<img src="./icon-64.png?t=1770055030.2372.0" />
<img src="./icon-64.png?t=1770055030.2372.1" />
<img src="./icon-64.png?t=1770055030.2373.2" />
<img src="./icon-64.png?t=1770055030.2373.3" />
<img src="./icon-64.png?t=1770055030.2373.4" />
<img src="./icon-64.png?t=1770055030.2373.5" />
<img src="./icon-64.png?t=1770055030.2373.6" />
<img src="./icon-64.png?t=1770055030.2373.7" />
<img src="./icon-64.png?t=1770055030.2373.8" />
<img src="./icon-64.png?t=1770055030.2373.9" />
<img src="./icon-64.png?t=1770055030.2373.10" />
<img src="./icon-64.png?t=1770055030.2373.11" />
<img src="./icon-64.png?t=1770055030.2373.12" />
<img src="./icon-64.png?t=1770055030.2373.13" />
<img src="./icon-64.png?t=1770055030.2373.14" />
<img src="./icon-64.png?t=1770055030.2373.15" />
<img src="./icon-64.png?t=1770055030.2373.16" />
<img src="./icon-64.png?t=1770055030.2373.17" />
<img src="./icon-64.png?t=1770055030.2373.18" />
<img src="./icon-64.png?t=1770055030.2373.19" />
<img src="./icon-64.png?t=1770055030.2373.20" />
<img src="./icon-64.png?t=1770055030.2373.21" />
<img src="./icon-64.png?t=1770055030.2373.22" />
<img src="./icon-64.png?t=1770055030.2373.23" />
<img src="./icon-64.png?t=1770055030.2373.24" />
<img src="./icon-64.png?t=1770055030.2373.25" />
<img src="./icon-64.png?t=1770055030.2373.26" />
<img src="./icon-64.png?t=1770055030.2373.27" />
<img src="./icon-64.png?t=1770055030.2373.28" />
<img src="./icon-64.png?t=1770055030.2373.29" />
<img src="./icon-64.png?t=1770055030.2373.30" />
<img src="./icon-64.png?t=1770055030.2373.31" />
<img src="./icon-64.png?t=1770055030.2373.32" />
<img src="./icon-64.png?t=1770055030.2373.33" />
<img src="./icon-64.png?t=1770055030.2373.34" />
<img src="./icon-64.png?t=1770055030.2373.35" />
<img src="./icon-64.png?t=1770055030.2373.36" />
<img src="./icon-64.png?t=1770055030.2373.37" />
<img src="./icon-64.png?t=1770055030.2373.38" />
<img src="./icon-64.png?t=1770055030.2373.39" />
<img src="./icon-64.png?t=1770055030.2373.40" />
<img src="./icon-64.png?t=1770055030.2373.41" />
<img src="./icon-64.png?t=1770055030.2373.42" />
<img src="./icon-64.png?t=1770055030.2373.43" />
<img src="./icon-64.png?t=1770055030.2373.44" />
<img src="./icon-64.png?t=1770055030.2373.45" />
<img src="./icon-64.png?t=1770055030.2373.46" />
<img src="./icon-64.png?t=1770055030.2373.47" />
<img src="./icon-64.png?t=1770055030.2373.48" />
<img src="./icon-64.png?t=1770055030.2373.49" />
<img src="./icon-64.png?t=1770055030.2373.50" />
<img src="./icon-64.png?t=1770055030.2373.51" />
<img src="./icon-64.png?t=1770055030.2373.52" />
<img src="./icon-64.png?t=1770055030.2373.53" />
<img src="./icon-64.png?t=1770055030.2373.54" />
<img src="./icon-64.png?t=1770055030.2373.55" />
<img src="./icon-64.png?t=1770055030.2373.56" />
<img src="./icon-64.png?t=1770055030.2373.57" />
<img src="./icon-64.png?t=1770055030.2373.58" />
<img src="./icon-64.png?t=1770055030.2373.59" />
<img src="./icon-64.png?t=1770055030.2373.60" />
<img src="./icon-64.png?t=1770055030.2373.61" />
<img src="./icon-64.png?t=1770055030.2373.62" />
<img src="./icon-64.png?t=1770055030.2373.63" />
<img src="./icon-64.png?t=1770055030.2373.64" />
<img src="./icon-64.png?t=1770055030.2373.65" />
<img src="./icon-64.png?t=1770055030.2373.66" />
<img src="./icon-64.png?t=1770055030.2373.67" />
<img src="./icon-64.png?t=1770055030.2373.68" />
<img src="./icon-64.png?t=1770055030.2373.69" />
<img src="./icon-64.png?t=1770055030.2373.70" />
<img src="./icon-64.png?t=1770055030.2373.71" />
<img src="./icon-64.png?t=1770055030.2373.72" />
<img src="./icon-64.png?t=1770055030.2373.73" />
<img src="./icon-64.png?t=1770055030.2373.74" />
<img src="./icon-64.png?t=1770055030.2373.75" />
<img src="./icon-64.png?t=1770055030.2373.76" />
<img src="./icon-64.png?t=1770055030.2373.77" />
<img src="./icon-64.png?t=1770055030.2373.78" />
<img src="./icon-64.png?t=1770055030.2373.79" />
<img src="./icon-64.png?t=1770055030.2373.80" />
<img src="./icon-64.png?t=1770055030.2373.81" />
<img src="./icon-64.png?t=1770055030.2373.82" />
<img src="./icon-64.png?t=1770055030.2373.83" />
<img src="./icon-64.png?t=1770055030.2373.84" />
<img src="./icon-64.png?t=1770055030.2373.85" />
<img src="./icon-64.png?t=1770055030.2373.86" />
<img src="./icon-64.png?t=1770055030.2373.87" />
<img src="./icon-64.png?t=1770055030.2373.88" />
<img src="./icon-64.png?t=1770055030.2373.89" />
<img src="./icon-64.png?t=1770055030.2373.90" />
<img src="./icon-64.png?t=1770055030.2373.91" />
<img src="./icon-64.png?t=1770055030.2373.92" />
<img src="./icon-64.png?t=1770055030.2373.93" />
<img src="./icon-64.png?t=1770055030.2373.94" />
<img src="./icon-64.png?t=1770055030.2373.95" />
<img src="./icon-64.png?t=1770055030.2373.96" />
<img src="./icon-64.png?t=1770055030.2373.97" />
<img src="./icon-64.png?t=1770055030.2373.98" />
<img src="./icon-64.png?t=1770055030.2373.99" />
</body>
</html>