Skip to content

Add LZ4 compression option to vtkXMLWriter

Steven Hahn requested to merge quantumsteve/vtk:test_compress_lz4 into master

This add LZ4 as an additional compression option in vtkXMLWriter and derived classes. While LZ4 has a lower compression factor than zlib, it is extremely fast. I wrote a small test writing a vtkImageData file with either a highly compressible or incompressible signal array. With incompressible (random) data, the lz4 and none options took about the same time though the lz4-compressed file was about 0.5 MB larger. With more easily compressed data, writing an lz4-compressed file took 10% the time of writing a zlib-compressed file. The zlib-compressed file is ~0.75 MB smaller, but both are less than 1% the size of the uncompressed file.

The lz4 library was copied from ParaView's ThirdParty directory.

I used these two files to compare compressors. CompareDataCompression.cxx CMakeLists.txt

Here are the times and file sizes on a Mid 2015 Macbook Pro.

random data, no compression. Time to write :0.955645 s filesize :138.708 MB random data, zlib compression. Time to write :2.74516 s filesize :138.792 MB random data, lz4 compression. Time to write :0.868145 s filesize :139.275 MB

ordered data, no compression. Time to write :0.939131 s filesize :138.708 MB ordered data, zlib compression. Time to write :0.481893 s filesize :0.739573 MB ordered data, lz4 compression. Time to write :0.0444959 s filesize :1.46992 MB

Merge request reports