Sample Header Ad - 728x90

Why is 7-zip much faster than other LZMA implementations in Linux?

1 vote
2 answers
700 views
Until now, I used to backup my data using tar with one of the LZMA compression options (--lzma, --xz or --lzip) I recently noticed that 7-Zip has been ported to Linux in 2021 (https://www.xda-developers.com/7-zip-linux-official-release/) . I'm not talking about the older P7Zip (https://p7zip.sourceforge.net/) , that doesn't seem to be maintained anymore, but about the official 7-Zip. So, I tested it, and was very surprised to discover that it's A LOT faster than all the others Linux LZMA implementations, for the same compression ratio. Below my tests (Debian 11). Please not that I emptied the RAM cache between every test (sync && echo 3 > /proc/sys/vm/drop_caches) I am working on a 163M folder, containing several type of files, PDF, text, open office, and so on...
$ du -hs TEST/
163M	TEST/
With 7-Zip it's compressed into a 127M file in 15 seconds :
$ time tar c -hp TEST/ | 7zz a -si test.tar.7z
real    0m14,565s
(...)

$ ll test.tar.7z
(...) 127M (...) test.tar.7z
Whereas with all the other implementations of LZMA, it takes almost 5 times longer (around 1'13"), for the same archive size !
$ time tar -chp --lzma -f test.tar.lzma TEST/
real    1m13,159s

$ time tar -chp --xz -f test.tar.xz TEST/
real    1m12,889s

$ time tar -chp --lzip -f test.tar.lz TEST/
real    1m12,525s

$ ll test.tar.{7z,lz*,xz}
(...) 127M (...) test.tar.7z
(...) 127M (...) test.tar.lz
(...) 127M (...) test.tar.lzma
(...) 127M (...) test.tar.xz
Just to be sure there's nothing wrong with tar, I did the same tests but piped tar's output to lzma|xz|lzip, instead of using the --lzma, --xz and --lzip switches. Same results. So, basically, 7-Zip's Linux version makes all other LZMA implementations look rather bleak. I think 7-Zip doesn't support Linux owners and permissions, but that's irrelevant when compressing a .tar file. So, does anybody know why 7-Zip's Linux version is so much faster than other LZMA implementations ? ```
Asked by ChennyStar (1969 rep)
Mar 17, 2024, 10:25 AM
Last activity: Apr 14, 2024, 08:49 AM