Brotli compression is very slow
See original GitHub issueBrotli seems to be extremely slow to compress files, the Umbraco backoffice JS bundle takes a whole 10 seconds to be served when using Brotli. After I overwrote the RequestHelper
to instead use gzip when available the time fell to 1-2 seconds.
I realize though that Brotli seems to do a better job at compressing the file (~400 KB vs ~600 KB for gzip), however, 10 seconds seems an unreasonably long time to compress the file, so I’m thinking it could perhaps be a bug somewhere?
I’m guessing at the end of the day it might not be a huge problem if the file is aggressively cached when running in production, but it still seems like something is off to me.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
We took a very detailed look at Brotli performance (both ...
So, Brotli makes sense for things we cache (because we can compress out of band) and for large files delivered over slow connections...
Read more >'You can't use Brotli for dynamic content'
Brotli is slow for compression. I enabled this on a static asset management tool a while ago and it took several times longer...
Read more >Brotli Compression: A Fast Alternative to GZIP Compression
Brotli has a better compression ratio (i.e. it produces smaller compressed files) across every level of compression. While GZIP does beat Brotli ......
Read more >How To Speed Up Your Web Application With Brotli ...
Lossless compression is a great way of lowering the amount of data that users have to download to access your application.
Read more >Improving website performance with brotli
In this experiment the compression speed of brotli at level 10 is about 100 times slower than gzip at level 6. This characteristic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sounds reasonable. But I wonder based on what @nikolajlauridsen says, if these would need to be configurable per bundle? Just like the cache buster is configurable per bundle. i.e. Global and Bundle level like many of the other options.
We need to find out what the ‘ideal’ level for brotli is and make that the default. I’m unsure if ‘lowest’ is the best. IMO the ‘best’ will be the setting that is faster and smaller than gzip.
Brotli is slow to compress at higher levels, while decompression is faster. Some benchmarks are here: https://quixdb.github.io/squash-benchmark/#results-table E: site seems bugged. Here’s an alternative benchmark; https://community.centminmod.com/data/attachment-files/2019/04/7885_compress-benchmarks-010.png
But these files will be cached on disk (unless you use Smidge.InMemory), so it shouldn’t matter too much. It’s just a one time thing that happens.