Speed up website by compression!
Why website speed is important?
- Less time to transfer
- Reduce page load
- Saves bandwidth -> save money (Good for us and visitor)
- First impressions
- 47% of people expect web site to load in 2 seconds or less!
- 40% will abandon if it takes longer than 3 seconds
- User experience. It's feeling
- Google don't like slow website. Your google ranking will affected
- Currently compression format is gzip, zopfli, brotli, bz2, xz
- Most popular is gzip, but brotli is fast growing up
- Compression is not free. It use CPU to operation
- Text compression only, don't use with binary.
- Compress static content, i.e. html, js, css, xml, svg, json, rss
- Do not compress binary file such as images (jpg,png,gif) or multimedia (mp3,mp4). It already compressed. Not help.
- Higher compression ratio (level) -> higher CPU usage
Gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and intended for use by GNU (the "g" is from "GNU"). Version 0.1 was first publicly released on 31 October 1992, and version 1.0 followed in February 1993. (source: wikipedia)
Bzip2 is a free and open-source file compression program that uses the Burrows–Wheeler algorithm. It only compresses single files and is not a file archiver. It is developed by Julian Seward and maintained by Federico Mena. Seward made the first public release of bzip2, version 0.15, in July 1996 (source: wikipedia)
Brotli was first released in 2013 for off-line compression of web fonts. The version of Brotli released in September 2015 by the Google software engineers (source: wikipedia)
Base on brotli, gzip, xz and bz2 compression testing by Jeroen Ooms.
|Web browser support (caniuse.com)||100%||89.91%|
|Effective (size)||fair||best (better gzip, up to 30%)|
Web Browser supported?
The smaller files mean faster content delivery, speed up web page load and reduce bandwidth cost!
I recommend to use brotli with static text content (html, css, js, svg, json, xml, rss, etc...) at level 4 is enough and use gzip for on-fly (dynamic) content.
- Understanding Brotli's Potential by Akamai
- Results of experimenting with Brotli for dynamic web content by CloudFlare
- Microsoft endorses Google's Brotli compression algorithm, announces alpha preview for .NET
- 'You can't use Brotli for dynamic content'
- Brotli vs Gzip Compression. How we improved our latency by 37%
- Brotli Compression – How Much Will It Reduce Your Content?
- Round 3: Compression Comparison Benchmarks: zstd vs brotli vs pigz vs bzip2 vs xz etc
- Compression Benchmarks: brotli, gzip, xz, bz2
- Text Compression in R: brotli, gzip, xz and bz2
- Brotli and Static Compression
- Squash Compression Benchmark
- Gzip and Brotli Compression Level Estimator!
- Introducing Support for Brotli Compression by Microsoft (2017)
- Apache เตรียมรองรับการบีบอัด Brotli ของกูเกิล (2016)
- กูเกิลเสนอ Brotli ขั้นตอนวิธีบีบอัดเว็บแบบใหม่ บีบอัดได้มาก, ขยายได้เร็ว (2015)
- Microsoft Edge เตรียมใช้อัลกอริทึมบีบอัดข้อมูล Brotli
- 20 Ways to Speed Up Your Website and Improve Conversion in 2019
- เว็บช้าใครจะอยากเข้า – 6 เทคนิคเร่งสปีดให้เว็บโหลดเร็วปรู๊ด