Comparison of rar, bzip2, lbzip2 compression

Recently, I've been busy preparing various directories for additional archiving in Linux (it's about files from the /var/log/ location) containing archives of reports of performed operations in the system and running programs (services such as www etc.). Since I often use archiving to RAR format, I decided to see if it would work in this case as well.

I performed the test on Debian 11 (Linux kernel 5.10.0-13-amd64), on a system with 2 Xeon E5-2630L v2 processors, equipped with 64GB of RAM and an SSD (SATA) drive.

First, I created a tar archive of the entire /var/log directory using the command "time tar -pcf log.tar /var/log". The created archive occupies 1.7GB on the disk. Below are the results done with these commands:
rar archiving (registered v 6.12, from the manufacturer's website): time rar a -m5 -ma5 -md64m -mt24 -r /log.rar /log.tar
bzip2 archiving (v 1.0.8, installed with apt): time bzip2 -k -z -9 log.tar
lbzip2 archiving (v 2.5, installed with apt): time lbzip2 -k -z -9 log.tar

The time command allows you to determine the amount of time the command used to run. Here are the results:

Archive (file name) Archive creation time (seconds) File size (KB)
log.tar 2,64 1758197
log.rar 36,87 276366
log.tar.bz2 (bzip2) 313,06 275410
log.tar.bz2 (Lbzip2) 7,83 274947

As you can see, the best performance is in archiving to a bz2 file, using lbzip2 (which is a bzip2 implementation capable of using multiple cores, hence the big speedup).