How to compress/decompress a small message with a shared dictionary? #526

Closed
opened 2026-01-29 20:45:14 +00:00 by claunia · 1 comment
Owner

Originally created by @pkolaczk on GitHub (Oct 25, 2024).

I can see only the function BrotliEncoderCompressStream can use a shared dictionary (need to attach it first), but one-shot compression/decompression functions like BrotliEncoderCompress and BrotliDecoderDecompress can't.

What is the recommended way to compress/decompress a series of small (a few kB each), independent messages?

Originally created by @pkolaczk on GitHub (Oct 25, 2024). I can see only the function `BrotliEncoderCompressStream` can use a shared dictionary (need to attach it first), but one-shot compression/decompression functions like `BrotliEncoderCompress` and `BrotliDecoderDecompress` can't. What is the recommended way to compress/decompress a series of small (a few kB each), independent messages?
Author
Owner

@eustas commented on GitHub (Nov 19, 2024):

BrotliEncoderCompress and BrotliDecoderDecompress in an API mistake, we don't recommend using them (except for simplest testing code).

Recommended way to use streaming API. If dictionary does not change, it is recommended to prepare dictionary once and reuse prepared instance for encoding.

@eustas commented on GitHub (Nov 19, 2024): `BrotliEncoderCompress` and `BrotliDecoderDecompress` in an API mistake, we don't recommend using them (except for simplest testing code). Recommended way to use streaming API. If dictionary does not change, it is recommended to prepare dictionary once and reuse prepared instance for encoding.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#526