Zstandard compression in relay plugin
By Sébastien Helleu on Friday, January 7 2022, 20:47 - plugins - Permalink
Zstandard compression has been added in weechat protocol of relay plugin (see important notes in the release notes).
It offers better and faster compression (on WeeChat side) and faster decompression (client side).
Example of a small message (53KB), default compression (20):
WeeChat: obj: 2964/53611 bytes (zstd: 95%, 0,12ms) Client: decompressed (zstd): 53606 bytes, ratio: 95%, parsed in 0.67ms)
WeeChat: obj: 3752/53611 bytes (zlib: 94%, 0,23ms), id: quiet Client: decompressed (zlib): 53606 bytes, ratio: 94%, parsed in 2.10ms)
Example of a big message (2.3MB), default compression (20):
WeeChat: obj: 133280/2376095 bytes (zstd: 95%, 2,97ms), id: quiet Client: decompressed (zstd): 2376090 bytes, ratio: 95%, parsed in 15.03ms)
WeeChat: obj: 345255/2376095 bytes (zlib: 86%, 12,72ms), id: quiet Client: decompressed (zlib): 2376090 bytes, ratio: 86%, parsed in 21.20ms)
So with the same compression level:
- zstd is up to 4x faster on compression than zlib (WeeChat side)
- zstd is up to 3x faster on decompression than zlib (client side)
- compressed packets are up to 2.6x smaller with zstd than zlib.