Skip to content
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

ZSTD and LZ4 compression support #11

Open
Diatrus opened this issue May 11, 2020 · 4 comments
Open

ZSTD and LZ4 compression support #11

Diatrus opened this issue May 11, 2020 · 4 comments

Comments

@Diatrus
Copy link

Diatrus commented May 11, 2020

I’m wondering if it’ll be possible to add the LZ4 and ZStandard compression algorithms to this library in the future. Personally I would find it useful, as both have outstanding decompression times, and Zstd has a great compression ratio.

@tsolomko
Copy link
Owner

Well, this is a good question. General answer: yes, it is possible to add these algorithms at some point in the future (disregarding any unforeseen implementation difficulties which may prevent doing so). I also have some additional thoughts about each of these two algorithms:

  1. ZSTD. I did consider some time ago implementing Zstandard, but I found that there was an existing Swift library with an implementation of ZSTD, so I wasn't sure if there was any point in reimplementing it here, in SWCompression. I haven't looked into it thoroughly so I don't know if that library was a native Swift implementation or just a wrapper over the reference implementation. If it is the latter then there is still some potential value in implementing it in pure Swift, since this is the stated goal of SWCompression after all. I also have no idea what is the current status of that library, and, to be fair, I don't even remember its name.

  2. LZ4. Honestly, I've never thought about implementing it, since I don't know if/where it is even used (nowadays or in the past). How would you use it personally?

@Diatrus
Copy link
Author

Diatrus commented May 11, 2020

Regarding the first point, if the library you are referencing is this, it is just a wrapper around preexisting Zstandard code rather than a pure Swift implementation.
Regarding the second point, LZ4 shines in decompression speeds.
image
The use-case for lz4 is the need for extremely quick decompression of rather large files. While LZ4 would be great to have, I wouldn't personally find as much use in it as I would Zstandard. It is a relatively niche compression algorithm with a very specific use-case: nearly unnoticeable decompression times for large files.
To the point of personal use at the moment: I'm a developer for Sileo where we use SWCompression thanks to its pure Swift implementation of various compression algorithms and was hoping to implement ZSTD support, but noticed it was missing from this framework.

@tsolomko
Copy link
Owner

tsolomko commented Nov 4, 2021

LZ4 has been implemented in 4.7.0.

@JimWallace
Copy link

Thanks for this wonderful package – I just wanted to drop in to +1 the request for ZSTD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants