688
submitted 10 months ago by yogthos@lemmy.ml to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] gamma@programming.dev 13 points 10 months ago
[-] dan@upvote.au 5 points 10 months ago

They both have their use cases. Zstandard is for compression of a stream of data (or a single file), while 7-Zip is actually two parts: A directory structure (like tar) plus a compression algorithm (like LZMA which it uses by default) in a single app.

7-Zip is actually adding zstd support: https://sourceforge.net/p/sevenzip/feature-requests/1580/

[-] TechieDamien@lemmy.ml 1 points 10 months ago* (last edited 10 months ago)

Well when using zstd, you tar first, something like tar -I zstd -cf my_tar.tar.zst my_files/*. You almost never call zstd directly and always use some kind of wrapper.

[-] dan@upvote.au 7 points 10 months ago

Sure, you can tar first. That has various issues though, for example if you just want to extract one file in the middle of the archive, it still needs to decompress everything up to that point. Something like 7-Zip is more sophisticated in terms of how it indexes files in the archive, so I'm looking forward to them adding zstd support.

FWIW most of my uses of zstd don't involve tar, but it's in things like Borgbackup, database systems, etc.

[-] TechieDamien@lemmy.ml 1 points 10 months ago

Yes, definitely. My biggest use is transparent filesystem compression, so I completely agree!

[-] derpgon@programming.dev 4 points 10 months ago

I'll gunzip you to oblivion!

[-] AVincentInSpace@pawb.social 3 points 10 months ago

zstd may be newer and faster but lzma still compresses more

[-] gamma@programming.dev 11 points 10 months ago* (last edited 10 months ago)

Thought I'd check on the Linux source tree tar. zstd -19 vs lzma -9:

❯ ls -lh
total 1,6G
-rw-r--r-- 1 pmo pmo 1,4G Sep 13 22:16 linux-6.6-rc1.tar
-rw-r--r-- 1 pmo pmo 128M Sep 13 22:16 linux-6.6-rc1.tar.lzma
-rw-r--r-- 1 pmo pmo 138M Sep 13 22:16 linux-6.6-rc1.tar.zst

About +8% compared to lzma. Decompression time though:

zstd -d -k -T0 *.zst  0,68s user 0,46s system 162% cpu 0,700 total
lzma -d -k -T0 *.lzma  4,75s user 0,51s system 99% cpu 5,274 total

Yeah, I'm going with zstd all the way.

[-] jodanlime@midwest.social 6 points 10 months ago

Nice data. Thanks for reminding me why I prefer zstd

[-] AVincentInSpace@pawb.social 1 points 10 months ago

damn I did not know zstd was that good. Never thought I'd hear myself say this unironically but thanks Facebook

[-] gamma@programming.dev 5 points 10 months ago

*Thank you engineers who happen to be working at Facebook

[-] AVincentInSpace@pawb.social 1 points 10 months ago

Very true, good point

[-] gamer@lemm.ee 2 points 10 months ago

As always, you gotta know both so that you can pick the right tool for the job.

this post was submitted on 13 Sep 2023
688 points (97.6% liked)

Programmer Humor

31326 readers
24 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS