From 647d9231457f4621a810b0b381de73f78d502536 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 16 Nov 2023 11:43:00 -0500 Subject: [PATCH] Improve blosc efficiency --- asdf_compression/blsc/compressor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asdf_compression/blsc/compressor.py b/asdf_compression/blsc/compressor.py index 19886f2..61875e9 100644 --- a/asdf_compression/blsc/compressor.py +++ b/asdf_compression/blsc/compressor.py @@ -7,10 +7,15 @@ class BloscCompressor(Compressor): def compress(self, data, **kwargs): import blosc - yield blosc.compress(data, **kwargs) + # Type size, necessary for shuffle filter efficiency + # TODO: This should be the type size of the data actually stored, not just "byte" or "uint8" + typesize = data.itemsize + + yield blosc.compress(data, typesize=typesize, **kwargs) def decompress(self, data, out, **kwargs): import blosc + # TODO: call `self._api.decompress_ptr` instead to avoid copying the output out[:] = blosc.decompress(b"".join(data), **kwargs) return out.nbytes