Skip to content

Blosc2 LZ4 is 2.8x slower than Blosc LZ4 #270

Open
@dmbelov

Description

@dmbelov

I checkout hdf5plugin tag v4.1.3 and compiled it with all optimizations upto AVX2. The python code below shows that Blosc2 is 2.8x slower than Blosc (I am running both compressors on a single thread). Is this expected? Am I doing something wrong?

import hdf5plugin
import h5py
import numpy

In [2]: hdf5plugin.get_config()
Out[2]: HDF5PluginConfig(build_config=HDF5PluginBuildConfig(openmp=True, native=True, bmi2=True, sse2=True, avx2=True, avx512=False, cpp11=True, cpp14=True, ipp=False, filter_file_extension='.so', embedded_filters=('blosc', 'blosc2', 'bshuf', 'bzip2', 'fcidecomp', 'lz4', 'sz', 'sz3', 'zfp', 'zstd')), registered_filters={'bshuf': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5bshuf.so', 'blosc': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5blosc.so', 'blosc2': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5blosc2.so', 'bzip2': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5bzip2.so', 'fcidecomp': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5fcidecomp.so', 'lz4': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5lz4.so', 'sz': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5sz.so', 'sz3': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5sz3.so', 'zfp': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5zfp.so', 'zstd': '/home/dmitryb/soft/hdf5plugin/build/lib.linux-x86_64-3.10/hdf5plugin/plugins/libh5zstd.so'})

def testh5(fname, x, **kwargs):
    with h5py.File(fname, 'w') as h5file:
        h5file.create_dataset('/x', data=x, **kwargs)

In [9]: x_abc = numpy.random.normal(size=(20, 50, 1000))

In [10]: %timeit testh5('blosc.h5', x_abc, **hdf5plugin.Blosc(cname='lz4', clevel=9, shuffle=1))
9.74 ms ± 296 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [11]: %timeit testh5('blosc2.h5', x_abc, **hdf5plugin.Blosc2(cname='lz4', clevel=9, filters=1))
27.9 ms ± 570 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions