Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Enable Better Compression of JS with Brotli


Level 2


JS bundles in Launch are compressed with gzip, which saves many bytes. However, there is a new compression algorithm which can yield even better network (and thus user) performance: Brotli.

Brotli is supported by all modern browsers and improves compression of JS by 14% over gzip (see the Akami Blog entry linked later).

A sample showing possible compression levels is

Here we can see that Launch bundles are compressed at gzip level 6, a good compromise between server performance and compression ratio.

On my bundle, the gzip compression ratio of 3.56 captures most of the benefits of compression (maximum gzip compression level results in a ratio of 3.57, but with dramatic increases in CPU requirements to compress to this level).

However, Brotli can compress my bundle to 3.78 at the same level of compression, while also reducing server CPU time. (see Understanding Brotli's Potential - The Akamai Blog). For static js files (like all of Launch's JS bundles) maximum compression can be performed once at the origin (on building the bundle) and then a cached version of this highly compressed file can be served to clients.

Since Akamai already supports brotli, basic support should only be a configuration change. Browsers which don't support brotli will still be served gzip content, but for the remaining 85% of users ( faster, better loading of analytics code awaits.