For the past few days, I was speed testing how fast my website loads and researching on how can I improve it. During this research, I came across many different ways and different techniques to improve a web page to load faster and render with a very minimal memory footprint, from coding standpoint to server configuration.
Here are the metrics of my website’s performance, studied and tested with…
- Google Developers Page Speed Performance tool
- Pingdom Website Speed Test
- GTmetrix Performance Tool
Notice that each test tool provides different performance test results. All the results are approximated based on their test strategy. However, there may be many other test tools to test out the website’s speed, but the important point to note is, these tools lets us know what went wrong and what can be done to improve it.
Here are some of things I had to do for improving..
Within HTML, JS & CSS files
- Inlining small CSS and scripting small JS within main document to minimize requests.
- Placing CSS in the document head.
- Sizing Content to Viewport.
- Serving Scaled images (If images are small sized, use data-uri’s instead)
Within .htaccess file. (This file exists on the domain root folder)
- Leverage Browser Caching by specifying a “Cache-Control” to all Files Matching html, js, css, etc…
- Specifying a “Vary: Accept-Encoding header” to advise public proxies to store both compressed and uncompressed version of the resource.
- Specifying a ETag Header to validate Cache for all resources ending with file names.
- Ensuring landing page redirects are avoided (enabled by default)
- Ensuring gzip compression (enabled by default)
- Ensuring Keep-Alive is enabled (enabled by default in http.conf. If shared host, then we would have to set it manually in .htaccess)
Having done that, I do had some unanswered questions during this research.
- How to leverage browser caching andE-Tag (Cache Validator) to certain resources that do not end with file name in .htaccess file?Example for Resource URL’s:
The above resource URL’s DO NOT END with any file names.
- Since these resources are not cached by some proxy caching servers. How to remove query string and encode the parameters into the URL for resources having “?” (see resource URLs example from Q.1 above).
- How to prioritize visible content for rendering “above-fold-content” (as suggested in the Google developers page test tool), when your page is just one single page template?
Here are the resources that I was going through this research process..
Happy Learning 🙂