A backdoor in xz
A backdoor in xz
Posted Mar 31, 2024 12:15 UTC (Sun) by mbunkus (subscriber, #87248)In reply to: A backdoor in xz by MarcB
Parent article: A backdoor in xz
Ooooh I hadn't been aware zstd has compression levels higher than 9. Good to know.
I did a couple more tests with this knowledge; here's the updated table:
| Type | Size | Time | |------------------|-----:|---------:| | uncompressed | 1.6G | — | | gzip | 78M | 6.9s | | bzip2 | 58M | 1m34.1s | | zstd | 62M | 0.9s | | zstd -9 | 51M | 3.9s | | zstd -19 | 44M | 3m38.6s | | zstd --ultra -22 | 41M | 21m43.1s | | xz | 43M | 4.5s | | xz -9 | 43M | 15.6s |
So yes, you can get zstd down to below xz, at least with content that is mostly text, but now the duration completely flips upside down with xz looking good with 5s & zstd being so far out of this world that it isn't funny anymore.
Note, though, that xz is multi-threaded & zstd all the others don't seem to be: zstd only used a single core even on --ultra -22 whereas xz -9 used eight of my 32 cores. That being said, "zstd -19" uses 14.6 times the amount of time, "zstd --ultra -22" is at an unbelievable 83.5 times, making it still slower per core than "xz -9".
Does multi-core processing matter? Let's take build pipelines such as a build server for a distribution such as Debian as an example. If they want to achieve high utilization of their resources, they have to run stuff in parallel. This means that they can either assign a single core to each build VM & run a lot of build VMs in parallel, or they can assign multiple cores to each build VM & run fewer of them. In the latter case having a compression step that can only make use of a single core & that takes x times the time of another compressor with similar results in compression ratio, that yields rather low utilization.
Don't get me wrong; I really like zstd & the tradeoffs it makes. I use it as my default compressor in most day-to-day use cases for its impressive speed, especially interactively. But when file size is a concern (e.g. a lot of countries out there where internet traffic is mostly mobile & therefore both slow & expensive at the same time), xz pretty much always wins, no matter how you look at it. It's really no big surprise for me it has gained such wide-spread usage in the OSS world.
