I think Libdeflate is the fastest tool out there right now, unless limiting to light-weight "level 1" style in which case maybe libslz wins out.
We integrated libdeflate support into Samtools; for (de)compression of sequencing alignment data in the BAM format. I suspect this is the cause of libdeflate becoming an official Ubuntu package as Samtools/htslib have it as a dependency. I recently retested several deflater algorithms on enwik8.
Code:
Tool Encode Decode Size
------------------------------------------
vanilla 0m5.003s 0m0.517s 36548933
intel 0m3.057s 0m0.503s 36951028
cloudflare 0m2.492s 0m0.443s 36511793
jtkukunas 0m2.956s 0m0.357s 36950998
ng 0m2.022s 0m0.377s 36881293
zstd (gz-6) 0m4.674s 0m0.468s 36548933
libdeflate 0m1.769s 0m0.229s 36648336
Note the file sizes fluctuate a bit. That's within the difference between gzip -5 vs -6 so arguably you'd include that in the time difference too.
I also tried them at level 1 compression:
Code:
Tool Encode Decode Size
------------------------------------------
vanilla 0m1.851s 0m0.546s 42298786
intel 0m0.866s 0m0.524s 56046821
cloudflare 0m1.163s 0m0.470s 40867185
jtkukunas 0m1.329s 0m0.392s 40867185
ng 0m0.913s 0m0.397s 56045984
zstd (gz) 0m1.764s 0m0.475s 42298786
libdeflate 0m1.024s 0m0.235s 39597396
Level 1 is curious as you can see very much how different versions have traded off the encoder algorithm speed vs size efficiency, with cloudflare and jtkukunas apparently using the same algorithm and intel/ng likewise. Libdeflate is no longer the fastest here, but it's not far off and is the smallest so it's in a sweet spot.
And for fun, level 9:
Code:
Tool Encode Decode Size
------------------------------------------
vanilla 0m6.113s 0m0.516s 36475804
intel 0m5.153s 0m0.516s 36475794
cloudflare 0m2.787s 0m0.442s 36470203
jtkukunas 0m5.034s 0m0.365s 36475794
ng 0m2.872s 0m0.371s 36470203
zstd (gz) 0m5.702s 0m0.467s 36475804
libdeflate 0m9.124s 0m0.237s 35197159
All remarkably similar sizes, bar libdeflate which took longer but squashed it considerably more. Libdeflate actually goes up to -12, but it's not a good tradeoff on this file:
Code:
libdeflate 0m14.660s 0m0.236s 35100586
Edit: I tested 7z max too, but it was comparable to libdeflate max and much slower.