compress
Syntax
compress(X, [method=’lz4’])
Arguments
X is a vector or a table.
method is a string indicating the compression algorithm. It can be either “lz4” or “delta”. The default value is “lz4”.
Details
Compress a vector or a table (since version 1.30.6) with the specified compression algorithm. The compressed vector needs to be decompressed with function decompress before it can be used in a calculation.
Examples
$ x=1..100000000
$ y=compress(x, "delta");
$ y.typestr();
HUGE COMPRESS VECTOR
$ select name, bytes from objs() where name in `x`y;
name |
bytes |
---|---|
x |
402653952 |
y |
13634544 |
Please note that if function size is applied on the compressed vector y, the result is the length of the compressed vector y instead of the original vector x. To extract information about x from y, we need to decompress y first.
$ y.size();
12670932
$ z=decompress(y);
$ z.size();
100000000
Related functions: decompress