
Brotli compression for the web - ssttoo
http://calendar.perfplanet.com/2015/new-years-diet-brotli-compression/
======
kevingadd
Brotli is an awesome codec, but in a lot of my tests it was not really
compelling versus LZHAM in terms of compression speed or compression ratio. In
some test cases it edges it out on speed or ratio, but on others it's a tie if
not worse. Sadly, in my testing I also hit at least one crash bug in the
Brotli compressor, which makes it feel like an immature codec. On the bright
side, the bug was fixed extremely quickly. I hope integration in browsers will
help push the codec forward and encourage the developers of other codecs to
try harder so that we get a really heated competition :-)

~~~
ericlaw
> " it was not really compelling versus LZHAM "

For those of us building things on the web, things supported by browsers are
far more compelling than those that are not.

------
diziet
The support is really only on firefox:
[http://caniuse.com/#search=brotli](http://caniuse.com/#search=brotli)

Chromium is still milling on this:
[https://code.google.com/p/chromium/issues/detail?id=452335](https://code.google.com/p/chromium/issues/detail?id=452335)

But there seems to be some progress:
[https://chromium.googlesource.com/chromium/src.git/+log/lkcr...](https://chromium.googlesource.com/chromium/src.git/+log/lkcr/third_party/brotli)

~~~
nailer
That's fine. It's quite possible they could sort out Chrome and most of the
world's browsers would have the feature by the end of the year. We live in
exciting times :-)

------
Sami_Lehtinen
More detailed comparison:
[https://www.gstatic.com/b/brotlidocs/brotli-2015-09-22.pdf](https://www.gstatic.com/b/brotlidocs/brotli-2015-09-22.pdf)

~~~
colanderman
Thank you. That is loads more informative than the linked blog post, which
does not even bother to compare to LZMA.

~~~
ericlaw
It doesn't bother to compare LZMA because no major browser is planning to add
LZMA.

------
amelius
I'm hoping for a compression algorithm which allows for separated codebooks,
so e.g. one can compactly send updates when previous versions have already
been transferred.

~~~
twotwotwo
Chrome has something like this called SDCH, but it hasn't seen a ton of
adoption outside Google:

[https://en.wikipedia.org/wiki/SDCH](https://en.wikipedia.org/wiki/SDCH)

[https://engineering.linkedin.com/shared-dictionary-
compressi...](https://engineering.linkedin.com/shared-dictionary-compression-
http-linkedin)

[https://aprescott.com/posts/sdch](https://aprescott.com/posts/sdch)

Guessing part of the hurdle is that you can't simply drop it in like gzip; you
have to generate a dictionary and serve it and refresh it now and then (the
LinkedIn post explains). And a CDN can't just cache "the SDCH'd version" of a
resource; ideally it'd cache one version for each recently used dict.

The other, slightly happier "problem," is that other tuning can make the
additional gains from SDCH less dramatic. I looked, and the Google homepage
has a blob of JS that's 40KB gzip+sdch'd--but it's ~100KB gzip -9'd, and
probably costs me 0KB most of the time because it's cacheable and its Last-
Modified is about a month ago.

CloudFlare's Railgun proxy does use delta coding to good effect, though in a
much different context (origin server to edge location).

I can imagine other variations, like priming Brotli's (de)compressor's history
buffer with the first bytes of the old version of a cacheable resource in an
If-None-Match request, if both sides have the old version handy and advertise
the encoding. Sounds like what you're saying. Like SDCH, that still isn't
drop-in; the server has to remember old versions of things. And it only
applies to cached resources.

Anyhow, interesting space.

~~~
twotwotwo
> priming Brotli's (de)compressor's history buffer with...the old version...if
> both sides...advertise the encoding

Too late to edit, but I mean a separate Accept-Encoding value for the diff-
like usage (brdiff or whatever), not piggy-backing on the value already being
added for Brotli. Clearly if you're messing with the history buffer it's no
longer Brotli-as-we-know-it.

------
kenOfYugen
Previous discussion from 3 months ago:

[https://news.ycombinator.com/item?id=10257305](https://news.ycombinator.com/item?id=10257305)

------
powturbo
You can make your own tests and your data with TurboBench:
[https://github.com/powturbo/TurboBench](https://github.com/powturbo/TurboBench)

------
nailer
Anyone know if there's something planned for haproxy?

------
Dylan16807
I still don't understand why it's 'br' in the header and not 'brotli'

~~~
sschueller
Maybe because the actual name is "Brötli" and "Zöplfi" coming from the Swiss
German naming of small breads. Umlauts are usually converted like so: "ö" to
"oe" but not always. So there may be confusion as to if it's "brotli" or
"broetli".

Then again, this is just some wild speculation. :)

~~~
kuschku
Actually, they decided the header would be .bro

During a lot of overplayed drama it was decided to rename it to .br instead.

~~~
dbaupp
What overplayed drama? The discussion happened on Firefox bug 366559, 'bro'
was raised in comment 146 and 'br' was proposed/"accepted" by 152. There was
of course a lot of complaints/trolling after the decision was made, but the
actual rename happened in a small number of comments over the course of a few
hours.

[146]:
[https://bugzilla.mozilla.org/show_bug.cgi?id=366559#c146](https://bugzilla.mozilla.org/show_bug.cgi?id=366559#c146)
[152]:
[https://bugzilla.mozilla.org/show_bug.cgi?id=366559#c152](https://bugzilla.mozilla.org/show_bug.cgi?id=366559#c152)

~~~
kuschku
Indeed, although I said it this way to avoid starting another debate –
obviously, that failed.

~~~
ifdefdebug
Look, talking about "a lot of overplayed drama" thus introducing your opinion
that "a lot of overplayed drama" had taken place is surely NOT the right way
to avoid starting another debate - but I'm inclined to believe you already
know that...

~~~
kuschku
Overplayed drama because I consider the whole situation to be ridiculous. It
does not matter if it’s bro, br, brötli or whatever.

The whole drama around it, and "feminism gone too far" is ridiculous, and,
worst of all, everyone claims the other side did far worse stuff than what
actually happened.

