| Brotli | |
|---|---|
| Original authors | Jyrki Alakuijala, Zoltán Szabadka |
| Developers | Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne |
| Initial release | 15 October 2013; 12 years ago (2013-10-15) |
| Stable release | |
| Written in | C |
| Operating system | Cross-platform |
| Platform | Portable |
| Type | Data compression |
| License | MIT License |
| Website | brotli |
| Repository | |
Brotli is alossless data compression algorithm developed by Jyrki Alakuijala and Zoltán Szabadka. It uses a combination of the general-purposeLZ77 lossless compression algorithm,Huffman coding and 2nd-ordercontext modelling. Brotli is primarily used byweb servers andcontent delivery networks tocompress HTTP content, making internet websites load faster. As successor togzip, it is supported by all major web browsers and has become increasingly popular, as it provides better compression than gzip.[2]
While Google'szopfli implementation of the deflate compression algorithm is named after Zöpfli, theSwiss German word for a snack-sizedbraided buttery bread,brotli is named after Brötli, the Swiss German word for abread roll.[3]
Google employeesJyrki Alakuijala and Zoltán Szabadka initially developed Brotli in 2013 to decrease the size of transmissions ofWOFF web font.[4] Alakuijala and Szabadka completed the Brotli specification during 2013–2016. The specification was accompanied with a reference implementation developed by two additional authors, Evgenii Kliuchnikov and Lode Vandevenne, who had previously developed Google'szopfli implementation ofdeflate andgzip compatible compression in 2013.[5]: 1 Unlike zopfli, which was a reimplementation of an existing data format specification, Brotli was a new data format and allowed the authors to improve compression ratios even further.[3]
The Brotli specification was generalized in September 2015 for HTTP stream compression (content-encoding type "br"). This generalized iteration also improved the compression ratio by using a predefined dictionary of frequently used words and phrases. The version of Brotli released in September 2015 by the Google software engineers contained enhancements in genericlossless data compression, with particular emphasis on use forHTTP compression. The encoder was partly rewritten, with the result that the compression ratio improved, both the encoder and the decoder have been sped up, the streaming API was improved, and more compression quality levels have been added. Additionally, the new release shows performance improvements across platforms, with decoding memory reduction.[3]
TheInternet Engineering Task Force approved the Brotli compressed data format specification as an informationalrequest for comment (RFC 7932) in July 2016.[6] The Brotli data format is an integral part of the 2nd iteration of theWeb Open Font Format,[6]: 3 which was recognized in a 2021 Technology & Engineering Emmy Award from theNational Academy of Television Arts & Sciences for font technology standardization at W3C.[7][8]
Brotli support has been added over the years to web browsers, with 96% of worldwide users using a browser that supports the format, as of July 2022.[9]
In 2016Dropbox reimplemented Brotli inRust to fulfill their requirement to be more secure against a malicious client.[10][11]
Brotli's new file format allows its authors to improve upon Deflate by several algorithmic and format-level improvements: the use of context models for literals and copy distances, describing copy distances through past distances, use of move-to-front queue in entropy code selection, joint-entropy coding of literal and copy lengths, the use of graph algorithms in block splitting, and a larger backward reference window are example improvements.
Unlike most general-purpose compression algorithms, Brotli uses a predefined dictionary, roughly 120 KiB in size, in addition to the dynamically populated ("sliding window") dictionary. The predefined dictionary contains over 13000 common words, phrases and other substrings derived from a largecorpus of text and HTML documents.[12][5] Using a predefined dictionary has been shown to increase compression where a file mostly contains commonly used words.[13]Brotli's sliding window is limited to 16 MiB. This enables decoding on mobile phones with limited resources, but makes Brotli underperform on compression benchmarks having larger files. The constraints of the small window size can be alleviated by usingLarge Window Brotli, which is not compatible with RFC 7932 (Brotli proper).[14]
Google's own implementation of the Brotli specification was released under the terms of thepermissive free softwareMIT license in 2016. A formal validation of the Brotli specification was independently implemented byMark Adler,[6]: 126 one of the co-authors of thezlib/gzip compression format and library. Adler's implementation was released under the terms of the similarly permissiveApache License.[15] Other implementations of the specification also exist, including one in the source-to-sourceHaxe language.
Brotli compression is generally used as an alternative to gzip on the web, as Brotli provides better overall compression.[16] Compared to gzip compression, JavaScript files compressed with Brotli are roughly 15% smaller, HTML files are around 20% smaller, and CSS files are around 16% smaller.[17]
The reference implementation does ship a command-line programbrotli similar togzip,[18] but use in the Unix-like world as a simple compressor is scarce.Libarchive developers find the raw stream format of.br files difficult to support, as there is nomagic number to indicate the file format.[19]
{{cite web}}:|author= has generic name (help)Currently we are testing "Large Window Brotli" extension that will allow up to 1GiB window. [...] "Large Window Brotli" is landed.
Without a magic signature, libarchive cannot automatically recognize the file type, so it cannot automatically decompress. (Libarchive does not consider the file name, only the contents.)