-
Load Time Setup
Have all of the site – or at least most of it – loaded within 2 to 4 seconds max.
- Perceived performance
- Load only essentials first, then load the rest progressively with Lazy Load, or on demand.
- First meaningful paint
Prepare Above the Fold (AtF) necessary inline styling and images.- Determine core CSS critical only for AtF content (e.g. layout, header, main typography, etc.)
- Place them all in a separate CSS file and link it in the <head> with a custom attribute: inline.
- Check number of roundtrips made to render AtF content.
- Compress images and files appearing in the AtF render [link].
- Make sure there are no calls blocking AtF render.
- First available interaction
Choose functionality prioritized by either appearance or importance.
- Perceived performance
-
Manifest
Add proper Manifest file [link].
-
Service Worker
Add proper Service Worker file [link].
-
Fonts Optimization
- HTML/CSS: Use hosted services like Google Fonts when using web fonts.
- HTML/CSS: Pick only the font variations you need for each font to reduce the web page load.
-
CSS Files Optimization
- CSS: Keep @imports to minimum.
- HTML: Use CSS CDNs.
-
JavaScript Files Optimization
- HTML: JavaScript files should be loaded at the end of the <body> tag.
- HTML: Load JavaScript files only when needed in current device view [link].
- HTML: Use CDNs.
-
Image Optimization
- Create Sprites:
- SVG Sprite
- PNG Sprite
- JPG Sprite
- Illustrator: Convert bitmap images to SVG images whenever possible.
- Photoshop: Other bitmap images should have 200% their original resolution, for Retina displays
- Photoshop: Compress properly any images left without compression with 50% to 75% rate and Progressive option checked [link].
- CSS: Create images for mobile-first approach
- CSS: @media to load different background image sizes [link].
- HTML: <picture> to load different image sizes [link].
- HTML: Use LazyLoad when necessary [link].
- Create Sprites:
-
Mobile First Conversion
Consider the experience for the mobile user as if there will not be a desktop version before you build for the desktop.
- Careful file load selection: Do you really need jQuery or all of the CSS right away?
- Media queries in CSS
- Mobile devices rarely operate at full capacity like desktops do, hence, they are not as fast or as powerful. So there are other things to consider in comparison to other devices, such as:
- Processing Power
- Memory Usage
- Battery Life
- Fast Connection Processing.
-
HTTP Optimization
Optimal HTTP usage is 6 to 8 parallel connections to any one domain.
Thus, reduce number of files using data combining, sprite maps and minification.- Correct 404 errors by removing non-existing assets from your code.
- Server response time
- Number of HTTP redirects
- Use HTTP2, if possible, for more parallel requests.
-
Task Runner: Gulp
-
Test & Analyze
Draw conclusions and take notes about the performance needs for your app/site by testing it on the following amazing tools, then follow their recommendations, if any.
- Page Speed
Use Google Page Speed to gather performance issues.
https://developers.google.com/speed/pagespeed/insights/ - Lighthouse (Chrome Extension)
Use Google Lighthouse to gather performance issues.
https://developers.google.com/web/tools/lighthouse/ - Set A Performance Budget
Visualize how well you are maintaining your performance goals.
https://codepen.io/bradfrost/pen/EPQVBp - Chrome DevTools
- Preliminary Test: Use DevTools to conduct further preliminary tests.
- Slow Bandwidth: Try simulating slow bandwidth.
- DOMContentLoaded – the DOM and CSS object model are ready. It is usually pretty close to your first meaningful paint, and fires immediately after DOM interactive.
- Capture screenshots – A capture filmstrip in the top part of the Network tab, to help visualizate specific time intervals of the loading of your site.
- Mobile Testing
- Think with Google
https://testmysite.withgoogle.com/intl/en-gb - mobiReady
https://ready.mobi/
- Think with Google
- Audience Device
You must have in mind what is probably the most commonly used device by your audience.
http://browserbench.org/MotionMark/
Use Motion Mark to better understand the processing abilities of your most commonly used devices. - Server Side Compression
Check whether your server uses Brotli or GZip:
https://tools.keycdn.com/brotli-test
https://checkgzipcompression.com
- Page Speed