Compressing the data before sending it to the client is almost a fundamental web development aspect. The lesser the number of bytes transferred down the wire, the faster the client would receive it. The most common compression schemes include gzip and Deflate.
Recently, I bumped into a relatively younger compression algorith, Brotli. After reading this post by linkedin, I was pretty much excited and thought to see the results for myself.
I created a demo project and am putting the comparison snapshot below.
The Browser Support for Brotli is quite good but not 100%. You could easily fallback to gzip for the Browsers that does not support Brotli.
Sending lesser number of bytes would surely improve the latency but remember that the Browser will still parse and evaluate the same number of bytes. So, it would be better if you do not rely upon compressing the data very much and ship the user the best version of yourself for a good user experience.
Top comments (0)