You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "nickva (via GitHub)" <gi...@apache.org> on 2026/06/10 03:28:58 UTC

Re: [I] Add zstd support as a compression method [couchdb]

nickva commented on issue #4400:
URL: https://github.com/apache/couchdb/issues/4400#issuecomment-4666167023

   Implementing basic zstd compression was fairly easy https://github.com/apache/couchdb/pull/6028
   
   Upstream Erlang/OTP had rejected a dictionary training API (for good reason) but it turns out zstd support "raw" dictionaries:
   
   ```erlang
   > Dict = ~"{\"type\":\"foo\",\"bar\":1,\"baz\":\"a\"}".
   <<"{\"type\":\"foo\",\"bar\":1,\"baz\":\"a\"}">>
   
   > {ok, C} = zstd:dict(compress, Dict).
   {ok,{cdict,#Ref<0.4075923125.4131520536.31325>}}
   
   > Doc = ~"{\"type\":\"foo\", \"bar\":2, \"baz\":\"b\"}".
   <<"{\"type\":\"foo\", \"bar\":2, \"baz\":\"b\"}">>
   
   > byte_size(iolist_to_binary(zstd:compress(Doc, #{dictionary=>C}))).
   29
   
   > byte_size(iolist_to_binary(zstd:compress(Doc))).
   43
   ```
   
   So we could have dictionaries after all


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org