Packet compression benchmark

Darik Horn
Mon, 11 May 2015 00:16:54 -0000

On Sun, May 10, 2015 at 7:17 PM, Guus Sliepen <guus at tinc-vpn.org>
wrote:
>
> Darik Horn sent a pull request adding support for LZ4.

The PR is:

* https://github.com/gsliepen/tinc/pull/78


> LZ4 is supposed
> to be a very fast compression algorithm, especially when it comes to
> decompression. I did a quick benchmark with zlib, LZO and LZ4. Now,
> there are many benchmarks you can find online, but most of them deal
> with compressing large files. Tinc on the other hand has to compress
> small packets individually

The proposed 1.1-LZ4 branch implements block mode.  Given that you are
familiar with the code, is there a way to guarantee packet ordering at
the decompressor so that stream mode can also be implemented?


> The data would suggest that LZO is better than LZ4 in almost all
> scenarios. Also, zlib with compression level 1 is worse in both speed
> and compression ratio than level 2.

Even in block mode, I got the usual tradeoff for non-pathological
data:  LZ4 produces a slightly larger image for much less CPU time
than LZO.

I'm working on getting LZ4 baked into an OpenWRT build for further
testing, which is the kind of embedded system where Tinc really
shines.