Recently I’ve been looking into some ways to optimise the loading speed of a website that I’m working on. One of the possible improvements suggested by Chromium’s Audit tool was to enable text compression. An obvious thing to do, one might say, but the question is not whether to do it at all but rather how to do it.
Let’s start from the beginning though. The idea is simple. Instead of serving plain text files like CSS and JavaScript to the browser, those files should be sent compressed so that the browser, upon receiving them, can decompress them to a plain text format. There is, of course, a CPU time cost to this approach but in most cases the savings from the data transfer outweigh it by a large margin . This is particularly true for mobile devices where the bandwidth is often limited.
Many servers nowadays support compression (be that dynamic or static) and there are plenty of resources describing how to enable it but for some reason I couldn’t quickly find information on how exactly to do it for Google Cloud Storage.