Microsoft brings Brotli compression to .NET in 'alpha-quality preview'
It is now two years since Google launched its open source compression algorithm, Brotli. Microsoft has already shown some interest in the technology, adding support to Edge late last year to speed up the loading of web pages. Having conducted rigorous tests with Brotli compression, Microsoft is now ready to bring it to .NET.
Microsoft's tests show that Brotli is at least as good as Deflate and gzip, in terms of compression levels and the amount of time it takes to compress and decompress. It is because of these results that Microsoft is happy to launch .NET support for Brotli compression "as an alpha-quality preview."
Microsoft tested Brotli, Deflate and gzip using both Optimal and Fastest settings. When it came to tests with CSS, HTML and JavaScript, Brotli was found to be at least as good as the competition, and usually better. The key to getting the best from Brotli -- just as with any compression technique -- is finding the best balance of compression level and time to execute.
The tests that were carried out put Brotli through its paces. Using the Weissman score developer for and popularized by the show Silicon Valley, it was found to outstrip gzip quite impressively.
Making the preview support available, Microsoft says:
Brotli is a relatively new compression algorithm. It's quite beneficial for web clients, with decompression performance comparable to gzip while significantly improving the compression ratio. These are powerful properties for serving static content such as fonts and html pages. Thus, if you currently use gzip or Deflate as compression for your web site (or have never used compression) you should give Brotli a try.
An early alpha preview version of the Brotli compression library is available for you today. You can use the preview in both .NET Framework and .NET Core applications. In typical sites we've seen faster load times between 14 percent to 30 percent, but your mileage will vary.
You can find out more over on the MSDN blog, and grab the source code from Microsoft's CoreFxLab repository.