Tech News
← Back to articles

Show HN: FastLanes based integer compression in Zig

read original related products more articles

zint

Integer compression library for Zig based on FastLanes

Features

High performance. Zint uses FastLanes internally so it implements fully vectorized delta encoding and bitpacking.

Safe decompress API. It is safe to decompress untrusted input.

Compresses each block (1024) elements inside the input dynamically. Automatically applies delta encoding if it is beneficial.

Example usage

const Z = @require ( "zint" ). Zint ( T ); const compress_buf = try std . heap . page_allocator . alloc ( u8 , Z . compress_bound ( input . len )); const compressed_size = Z . compress ( input , compress_buf ); const compressed = compress_buf [0 .. compressed_size ]; const output = try std . heap . page_allocator . alloc ( T , input . len ); try Z . decompress ( compressed , output ); std . debug . assert ( std . mem . eql ( T , output , input ));

License

Licensed under either of

... continue reading