From 601e84075006dd5f600879f2e88a0544ec1102a7 Mon Sep 17 00:00:00 2001 From: Daniel King Date: Wed, 2 Oct 2024 17:50:11 -0400 Subject: [PATCH] feat: cost of for is ~0 We fairly often perform FoR and then do not perform bitpacking because we have exceeded the depth. FoR is very cheap and only worthwhile in combination with bitpacking anyway, so setting its cost to zero should improve compression ratio with a minor decrease in compresssion speed. --- vortex-sampling-compressor/src/compressors/for.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vortex-sampling-compressor/src/compressors/for.rs b/vortex-sampling-compressor/src/compressors/for.rs index 01fb62f5dc..3e7df3141e 100644 --- a/vortex-sampling-compressor/src/compressors/for.rs +++ b/vortex-sampling-compressor/src/compressors/for.rs @@ -20,6 +20,10 @@ impl EncodingCompressor for FoRCompressor { FoR::ID.as_ref() } + fn cost(&self) -> u8 { + 0 + } + fn can_compress(&self, array: &Array) -> Option<&dyn EncodingCompressor> { // Only support primitive arrays let parray = PrimitiveArray::try_from(array).ok()?;