-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add zstd support #9316
Add zstd support #9316
Conversation
CT Test Results 4 files 227 suites 1h 54m 56s ⏱️ For more details on these failures, see this check. Results for commit 71de6c2. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
fff3661
to
c1feba5
Compare
Please keep the naming close to the original API (zstd.h and friends), it's easier to translate other examples to Erlang that way, plus all the documentation from zstd.h becomes usable. For example if I search zstd.h for "chunk" I find nothing relevant, since it's called "stream" there. |
Just wanted to say thanks for this! |
Updated the API to be |
Only one tiny comment following a quick look at the docs: all functions are verbs except |
26a5bed
to
c674c51
Compare
4c31fd5
to
94522b0
Compare
680c6f7
to
8bf306e
Compare
@essen John mentioned that in the past you have used |
Yes the deflateInit is done in one process and the actual deflate in another for Websocket. It's still like this today. Cowboy creates the contexts and then calls zlib:set_controlling_process. Websocket has no zstd compression extension RFC/draft so today this isn't necessary for zstd. I guess for deflate the init could be deferred as well, but it's just more convenient to fully prepare deflate while doing the Websocket negotiation. |
Allright, then I will keep the contexts process bound for now and if the need arises later we can add that functionality. Thanks for the prompt response! |
63ae6eb
to
f6f6a43
Compare
71de6c2
to
ecb4afc
Compare
ecb4afc
to
083c227
Compare
bf77d3b
to
15bc47f
Compare
Thank you!! |
This PR adds a module to stdlib that wraps the Zstandard library. Zstandard is a compression library that allows for faster compression than zlib, but with about the same compression ratio.
Zstandard is vendored into erts, allowing us to also use it inside the VM for future optimizations.
The API is still a bit of a work in progress, but any opinions about what things should be named are very welcome. I think that I may rename
zstd:chunk/2
tozstd:stream/2
and also possible breakzstd:contex/1,2
into separate functions for compression and decompression context, but I've not decided yet.This PR depends on #9315 for the doctests support.