ludocode / mpack

MPack - A C encoder/decoder for the MessagePack serialization format / msgpack.org[C]
MIT License
521 stars 82 forks source link

Considered adding LZ4 compression ? #73

Closed sgf closed 4 years ago

sgf commented 4 years ago

there's a strong implement in C# with LZ4 compression (MessagePack-CSharp) performance and powerful. I noticed that MPack is the best in C ++ implementation. Also very performance and powerful. Is the author interested in adding support for LZ4 compression?

ludocode commented 4 years ago

MPack lets you specify custom flush and fill callbacks for its buffers so it can be trivially hooked up to any stream. You should be able to make it use LZ4 or any compression algorithm without having to modify MPack at all. Just implement the relevant callbacks.

There's an example here of connecting the tree reader to a BSD socket. Instead of calling read(), just call lz4_inflate() or whatever the function is called for the compression library you're using. The idea is the same for the writer.

For this reason I don't think it's valuable to add support to MPack specifically for one compression library or another. It's better to keep it generic so that you can connect it to whatever compression library you want.

sgf commented 4 years ago

thanks