Photo by JJ Ying on Unsplash

Comparison of gzip, bzip2 and xz compression tools.

Konstantinos Patronas
LinuxStories

--

When storing data for archiving or transferring big files over the network the use of compression is often considered. Then we need to decide which tool to be use. In this article will test three of the most common compression tools to compress a 100MB ASCII file using all available compression levels VS compression speed, decompression speed, memory consumption, compression ratio.

Tests preparation / environment used

  • The file (compressed) that we will use for our tests can be find here http://mattmahoney.net/dc/enwik8.zip
  • gzip version 1.10
  • bzip2 version 1.0.8
  • xz version 5.2.4 (liblzma 5.2.4)
  • OS: Windows 11 / WSL 2 Ubuntu 20.04
  • CPU: AMD Ryzen 7 Mobile 3700U, 4 Cores 8 Threads
  • RAM: 16GB DDR4
  • SSD: WDC PC SN530

Notes on the environment: Most likely if the same test is going to be performed on another environment the measurements will differ, and this might or might not affect the comparison of the tools in terms which is better, so if you want to test it on your environment you can find the script that performs the tests in my GitHub repository

--

--

Konstantinos Patronas
LinuxStories

DevOps engineer, loves Linux, Python, cats and Rock music