Zstandard – Fast real-time compression algorithm
github.com
github.com
Dumb question, why dual license? Why not just provide it as BSD (the more permissive of the two)?
https://en.wikipedia.org/wiki/BSD_licenses#3-clause_license_...
Still doesn't explain why pure BSD won't work for them, though
When linking BSD code with GPL-licensed code, you have to have all the code follow the terms of GPL, which means effectively relicensing it. This is why some companies require copyright assignment even if they plan to stay open source.
Only the public domain code allows free mixing and matching.
Not a lawyer though, so take the above with a bowl of salt.
Edit: in theory, this allows using zstd in GPL2 projects, for instance, in the Linux kernel.
There are some licenses such as MIT where you can. But GPL is very much the code has to be GPL. But I also think it infects your code and forces your code to be GPL, but that may only be if you make a modification and change it and not just use GPL code within your code.
Does this dual license satisfy companies who have a policy of “no GPL” code?
For example, if I want to use Pango, which is GPLv2, in my application, then the GPL requires that I also release my application's source code as GPLv2, or another compatible license.
It also requires that if I make changes to Pango and redistribute it then I need to release the source code for that as well. In other words, if I fork Pango then my fork also has to be GPLv2.
It's not so much that it 'infects' your code as that it's not compatible with closed source (or some open source licenses).
A while back, Microsoft decided to abandon their awful TCP/IP stack and use a better one - FreeBSD's TCP/IP stack. Since FreeBSD is BSD-licensed, it was possible for them to take that code, use it, modify it, and redistribute compiled versions of it, without having to give back any changes or optimizations to the open-source community.
By choosing the BSD license for their code, the project was implicitly saying that they were okay with this code sharing, and so they don't look at this as a bad thing. Microsoft's OS got better, and it didn't cost anyone else anything.
Some groups, however, think that open-source should only benefit open-source, because that's beneficial to users and the world as a whole. This is the purpose of the GPL: you can use our code, but only if all of us benefit and not just you.
> This key dispute is whether non-GPL software can legally statically link or dynamically link to GPL libraries. Different opinions exist on this issue. The GPL is clear in requiring that all derivative works of code under the GPL must themselves be under the GPL. Ambiguity arises with regards to using GPL libraries, and bundling GPL software into a larger package (perhaps mixed into a binary via static linking). This is ultimately a question not of the GPL per se, but of how copyright law defines derivative works.
https://en.wikipedia.org/wiki/GNU_General_Public_License#Lin...
More than theory, there is actually an implementation of zstd in the Linux kernel. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
Show HN: Reduce SQLite database size by up to 80% with transparent compression - https://news.ycombinator.com/item?id=32303762 - Aug 2022 (90 comments)
sqlite-zstd: Transparent dictionary-based row-level compression for SQLite - https://news.ycombinator.com/item?id=32297193 - July 2022 (1 comment)
- Q: Is this library production ready?
A: I wouldn't trust it with my data (yet). Make sure you have backups of everything.
- usual zstd checksum is stripped from compressed data
- columns you want to index can't be compressed
- works best with rows containing less than ~30kB of data Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases. Zstandard is considered safe for production environments.The part that is claimed as not production ready is the third party sqlite integration.
Skimming the code I can see why. It does some pretty gnarly things involving altering the schema of all your tables. Not to say it doesn't work or isn't good, but, it seems like it really does a lot of intrusive, potentially failure prone stuff.
I wish browsers supported it for content encoding because it's a good deal faster and smaller than gzip, nevermind brotli.
I ended up using lz4 instead for my project. Lz4 only added 4kb to my compiled wasm size for an encoder and decoder. And it’s native rust (which makes wasm compilation effortless). Lz4 is a no-brainer to include.
The downside of lz4 is that it can’t be configured to run at higher & slower compression ratios.
lz4 has some level of configurability? https://github.com/lz4/lz4/blob/v1.9.4/lib/lz4frame.h#L194
There's also LZ4_HC.
It may not offer the same API 1:1, but it has no interoperability issues that I've encountered. I think no one has bothered to implement it in Rust because most use cases don't mind the added bloat you're talking about, not because implementing it in Rust would be insurmountable. Plus, other comments I've seen suggest that you can actually tune the size of the C zstd library, although I'm not sure if the Rust bindings expose that.
> While it's true that a kitchen-sink version of libzstd does weigh in at 1.5MB, the build is easily configurable and much of that can be shed. If Chromium is just going to ship the decoder, a full build of the decoder is 212kB (162kB stripped, 71kB gzipped). A size-optimized version of that is 99kB (62kB stripped, 26kB gzipped). As of recently, we had someone from the busybox project working to strip that down even more, so we very well may be able to improve further on those numbers.
While still larger than 4K, it does seem possible to make much smaller builds.
I can't remember encountering anything that compresses better with gzip than with brotli, so brotli is usually a better choice than gzip to reduce bandwidth, and brotli has been better than zstd on more than a few occasions for me as noted previously. Brotli is very worthwhile, at least for static assets, and choosing to offer only gzip compressed assets to browsers is almost always a waste of bandwidth.
If faster to compress is all you care about, then sure, brotli might not be the best choice.
I'm looking at my static assets now; our largest JS bundle is 6.3MB uncompressed. With brotli at level 9 it takes 400ms to compress down to 1.34mb, and with zstd at level 13 it squeezes down to 1.31mb in 300ms. If I use zstd at level 19, it takes 1.1s to compress, but size is even further reduced to 1.21mb. Decompression time is identical for both (33ms). So, for our static data the edge goes to zstd.
For dynamic data there's no contest. Most of our responses are binary and brotli is not just slow, it's so slow we have to disable it otherwise people assume our services have hung. By far most of the data that leaves our servers is dynamic, so having zstd support in browsers would be a huge win for us because we would spend less time compressing (compared to gzip) and have smaller responses.
I was looking at one particularly pathological case last month where we had a 2.7gb response that was quite sparse. We were spending 30s of server time as part of the request in gzip, the end result being 52mb. With zstd at level 12 it was 5s to compress it down to 41mb. I don't even know how long it would have taken with brotli as I stopped timing after 10 minutes.
I mean, if brotli wasn't working for people it wouldn't be supported by browsers, but I really really wish zstd was an option.
It's just a pity that storage providers won't implement transparent compression. We store our logs on S3 and on-prem and it's just annoying that we have to store them compressed on S3. Would be cool to just store without the compression stage and have S3 do that bit.
I haven't tried btrfs with the transparent zstd compression, but perhaps worth a shot.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/olap-c...
Maybe they could offer it as an extra, and spawn EC2 instances as needed and bill you.
Looking at that table, I think LZ4 is a winner. The compression ratio is not too far, compression speed is slightly faster, decompression speed is significantly faster, the code is much simpler so the compiled binary is smaller, and the project is unrelated to Facebook.
It sounds like they haven't decided whether to do it or not
except
* standard 7z does not support zstandard
* 7z file extension does not explain what's inside, so if you hand .7z file with zstd inside to someone, that person will blame you for unopenable archive
well if only we could rebrand 7z-with-zstd as some new format, e.g. .zstd (no changes required) ...
Use `tar` format and you can combine it with whatever compression utilities available such as `gzip`, `bzip2`, `lz4`, `zstd`, `xz`, etc. `tar` also preserves Unix permission. The downside is tar doesn't have an index for random-access, so you cannot do partial extraction quickly.
Use `zip` format if you don't care about Unix permission, and want to do partial extraction. `Zip` technically support multiple compression algorithms, but is primarily only used with DEFLATE (the same one as `gzip`) for compatibility reason.
How to get your backup to half of its size – ZSTD support - https://news.ycombinator.com/item?id=33644798 - Nov 2022 (51 comments)
Zstd Compressed Debug Sections - https://news.ycombinator.com/item?id=32788343 - Sept 2022 (4 comments)
Zstandard – Real-time data compression algorithm - https://news.ycombinator.com/item?id=32715933 - Sept 2022 (56 comments)
AWS switch from gzip to zstd – about 30% reduction in compressed S3 storage - https://news.ycombinator.com/item?id=32529412 - Aug 2022 (201 comments)
Show HN: Reduce SQLite database size by up to 80% with transparent compression - https://news.ycombinator.com/item?id=32303762 - Aug 2022 (90 comments)
The Bizarre Case of Zstd's Slow Performance on Arch Linux - https://news.ycombinator.com/item?id=31794958 - June 2022 (8 comments)
Zstandard Worked Example - https://news.ycombinator.com/item?id=31411714 - May 2022 (50 comments)
Zstandard RFC 8878 - https://news.ycombinator.com/item?id=29281360 - Nov 2021 (43 comments)
Compressing JSON: Gzip vs. Zstd - https://news.ycombinator.com/item?id=27707834 - July 2021 (11 comments)
Zstandard v1.5.0 - https://news.ycombinator.com/item?id=27155857 - May 2021 (36 comments)
Zstandard v1.4.7 - https://news.ycombinator.com/item?id=25455314 - Dec 2020 (73 comments)
Facebook/Zstandard – Fast real-time compression algorithm - https://news.ycombinator.com/item?id=24714854 - Oct 2020 (13 comments)
Zstandard - https://news.ycombinator.com/item?id=24348394 - Sept 2020 (11 comments)
Introduce ZSTD compression to ZFS - https://news.ycombinator.com/item?id=23210491 - May 2020 (38 comments)
Now using Zstandard instead of xz for package compression - https://news.ycombinator.com/item?id=21958585 - Jan 2020 (153 comments)
Zstandard v1.4.1 - https://news.ycombinator.com/item?id=20482424 - July 2019 (15 comments)
Zstandard v1.4.0 - https://news.ycombinator.com/item?id=19678115 - April 2019 (67 comments)
Improving compression at scale with Zstandard - https://news.ycombinator.com/item?id=18719592 - Dec 2018 (87 comments)
Zstandard – Fast real-time compression algorithm - https://news.ycombinator.com/item?id=18530628 - Nov 2018 (51 comments)
Zstandard Compression and the application/zstd Media Type - https://news.ycombinator.com/item?id=18133515 - Oct 2018 (19 comments)
Zstandard v1.3.4 – faster everything - https://news.ycombinator.com/item?id=16718402 - March 2018 (33 comments)
Zstandard – Real-time data compression algorithm - https://news.ycombinator.com/item?id=16226923 - Jan 2018 (96 comments)
Zstandard: Fast real-time compression algorithm from Facebook Opensource - https://news.ycombinator.com/item?id=16222669 - Jan 2018 (2 comments)
Better Compression with Zstandard - https://news.ycombinator.com/item?id=13813212 - March 2017 (62 comments)
Comparing gzip, brotli and zstd - https://news.ycombinator.com/item?id=12634812 - Oct 2016 (1 comment)
Smaller and faster data compression with Zstandard - https://news.ycombinator.com/item?id=12399804 - Aug 2016 (156 comments)
Zstandard – Fast and efficient compression algorithm - https://news.ycombinator.com/item?id=8941955 - Jan 2015 (24 comments)