Decompression equivalent to BrotliEncoderPrepareDictionary? #538

Open
opened 2026-01-29 20:45:22 +00:00 by claunia · 0 comments
Owner

Originally created by @pmeenan on GitHub (May 6, 2025).

For the shared brotli case, would there be a benefit to be able to prepare a dictionary in such a way that it can be reused in a decompression context across decodes like we can in compression with BrotliEncoderPrepareDictionary?

Currently we (Chrome) re-attach the raw dictionary to each new decode stream state which, I assume, involves some processing on the raw dictionary to build tables, etc.

For the document navigation case (and a few other cases like API calls), we reuse the same dictionary over and over and we could probably get a decent latency improvement by not having to rebuild the frequency tables/etc from a raw dictionary every time.

I'm assuming we could probably transform a raw dictionary into a serialized dictionary and maybe get some of the benefit, but I was hoping that we might also expose a shortcut to be able to reuse a fully-parsed raw dictionary.

For context, I'm adding an in-memory cache in Chrome right now for the dictionaries and if I could cache the processed version it might eek out a few more milliseconds of latency on slower devices.

Originally created by @pmeenan on GitHub (May 6, 2025). For the shared brotli case, would there be a benefit to be able to prepare a dictionary in such a way that it can be reused in a decompression context across decodes like we can in compression with BrotliEncoderPrepareDictionary? Currently we (Chrome) re-attach the raw dictionary to each new decode stream state which, I assume, involves some processing on the raw dictionary to build tables, etc. For the document navigation case (and a few other cases like API calls), we reuse the same dictionary over and over and we could probably get a decent latency improvement by not having to rebuild the frequency tables/etc from a raw dictionary every time. I'm assuming we could probably transform a raw dictionary into a serialized dictionary and maybe get some of the benefit, but I was hoping that we might also expose a shortcut to be able to reuse a fully-parsed raw dictionary. For context, I'm adding an in-memory cache in Chrome right now for the dictionaries and if I could cache the processed version it might eek out a few more milliseconds of latency on slower devices.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#538