compress#

swordfish.function.compress()#

Compress a vector or a table with the specified compression algorithm. The compressed variable needs to be decompressed with function decompress before it can be used in a calculation.

Parameters:
  • X (Constant) – A vector or a table.

  • method (Constant, optional) –

    A string indicating the compression algorithm. The available options are:

    • ”lz4” (by default) is suitable for almost all data types. Although the “lz4” method may not achieve the highest compression ratio, it provides fast compression and decompression speeds.

    • ”delta” option applies delta-of-delta algorithm, which is particularly suitable for data types like SHORT, INT, LONG, and date/time data.

    • ”zstd” is also suitable for almost all data types. It provides a higher compression ratio compared to “lz4”, but the compression and decompression speed is about half as fast as “lz4”.

    • ”chimp” is suitable for DOUBLE type data with decimal parts not exceeding three digits in length.