The Google Chrome team has always only focused on two issues: first, how to reduce memory usage, and second, how to improve website loading speed (just kidding, but Google has made the most changes in these aspects over the years). Now Google is researching a new shared dictionary compression technology to greatly improve the compression efficiency of website resources, thereby further shortening the loading time of the website.

Here's a simple example:

Assume that the website is built using the Angular framework. The currently used framework version is version 1.7.9. The file size is 172KiB without compression. If the Brotli compression algorithm is used, the size can be reduced to 53KiB, which means a compression rate of approximately 70%.

At this time, developers need to upgrade the framework version from version 1.7.9 to version 1.8.3. Since the size of the new version is similar to the old version, the volume after using the Brotli compression algorithm is also similar.

However, if you use the custom shared dictionary function, you can use the resource dictionary of the previous version to compress the resources of the new version. In this way, the actual output file is only about 4KiB, and the compression rate is as high as 98%. This can greatly reduce the files that the browser needs to download, thereby improving the loading speed of the website.

Custom shared dictionary technology:

The Chrome team explained that a custom dictionary is an external file that can be applied to any input. These dictionaries can be product code that is highly specific to a single application or any content. The suitability of the dictionary for the input can have a huge impact on the overall compression efficiency. Dictionaries that are highly similar to the input content can actually achieve higher compression rates.

In the past, decompressing files required using a dictionary, which uses a process called SDCH, but has potential security vulnerabilities. Chrome claims that the new shared dictionary compression technology has solved these security issues, and both dynamic and static resources can gain more benefits.

Later, Chrome will declare supported compression algorithms in Accept-EncodingHeader, such as gzip, br (ie Brotli), zstd (ie ZStandard), etc. When the shared dictionary is enabled, additional declarations will be added, including br-d or zstd-d.

Developers use this feature:

If developers want to use this feature in a production environment during the current testing phase, they need to register with Chrome's OriginTrial to obtain a token, and then use this token on the website to enable the shared dictionary compression feature.

For individual users, you can turn on the CompressionDictionaryTransport experimental option in Chrome. If the website you visit has obtained a token to open the shared dictionary, it can be used.

viaChromeDeveloper: https://developer.chrome.com/blog/shared-dictionary-compression?hl=en