Skip to main content

A C++ implementation with Python bindings of StreamVByte.

Project description


libstreamvbyte


Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Reference
  7. Contact

About The Project

libstreamvbyte is a C++ implementation of StreamVByte, with Python bindings using pybind11.

StreamVByte is a integer compression technique that use SIMD instructions (vectorization) to improve performance. The library is optimized for CPUs with the SSSE3 instruction set (which is supported by most x86_64 processors), and can also be used with ARM processors and other 32-bit architectures, although it will fall back to scalar implementations in those cases.

With libstreamvbyte, you can quickly and efficiently compress integer sequences, reducing the amount of storage space and network bandwidth required. The library is easy to use and integrates seamlessly with Python via pybind11 bindings. Whether you're working with large datasets or building a distributed computing system, libstreamvbyte can help you improve performance and reduce the resources needed to handle your data.

Currently supports Python 3.10+ on Windows, Linux (manylinux_2_17, musllinux_1_1) and macOS (universal2).

(back to top)

Getting Started

Installation

For Python

Install from PyPI using pip.

pip install libstreamvbyte

Or install from .whl file.

pip install "path/to/your/downloaded/whl"

To find appropriate .whl file, please visit releases.

For C++

You must have CMake installed on your system.

# clone the repo
git clone https://github.com/wst24365888/libstreamvbyte
cd libstreamvbyte

# build and install
cmake .
make
sudo make install

Usage

For Python

Import libstreamvbyte first.

import libstreamvbyte as svb

And here are the APIs.

# Encode an array of unsigned integers into a byte array.
encode(arg0: numpy.ndarray[numpy.uint32]) -> numpy.ndarray[numpy.uint8]

# Decode a byte array into an array of unsigned integers.
decode(arg0: numpy.ndarray[numpy.uint8], arg1: int) -> numpy.ndarray[numpy.uint32]

# Encode an array of signed integers into an array of unsigned integers.
encode_zigzag(arg0: numpy.ndarray[numpy.int32]) -> numpy.ndarray[numpy.uint32]

# Decode an array of unsigned integers into an array of signed integers.
decode_zigzag(arg0: numpy.ndarray[numpy.uint32]) -> numpy.ndarray[numpy.int32]

For C++

Include streamvbyte.h first.

#include "streamvbyte.h"

For the APIs, please refer to include/streamvbyte.h.

Example

For Python

import libstreamvbyte as svb

N = 2**20 + 2

# type(original_data) == np.ndarray
# original_data.dtype == np.int32
original_data = np.random.randint(-2**31, 2**31, N, dtype=np.int32)

# type(compressed_bytes) == np.ndarray
# compressed_bytes.dtype == np.uint8
compressed_bytes = svb.encode(svb.encode_zigzag(original_data))

# type(recovered_data) == np.ndarray
# recovered_data.dtype == np.int32
recovered_data = svb.decode_zigzag(svb.decode(compressed_bytes, N))

For C++

#include "streamvbyte.h"

int main() {
    std::size_t N = (1 << 20) + 2;

    std::vector<int32_t> original_data(N);
    for (std::size_t i = 0; i < N; ++i) {
        original_data[i] = rand() - rand();
    }

    std::vector<uint8_t> compressed_bytes = streamvbyte::encode(streamvbyte::encode_zigzag(original_data));
    std::vector<int32_t> recovered_data = streamvbyte::decode_zigzag(streamvbyte::decode(compressed_bytes, N));

    return 0;
}

Compile it with linking to libstreamvbyte.

g++ -o example example.cpp -lstreamvbyte

(back to top)

Roadmap

  • Zigzag encoding/decoding.
  • Support ARM processors with NEON intrinsics.
  • Differential coding (delta encoding/decoding).

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feat/amazing-feature)
  3. Commit your Changes with Conventional Commits
  4. Push to the Branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Reference

(back to top)

Contact

Author

Project Link

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libstreamvbyte-0.2.1.tar.gz (761.8 kB view details)

Uploaded Source

Built Distributions

libstreamvbyte-0.2.1-cp311-cp311-win_amd64.whl (60.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

libstreamvbyte-0.2.1-cp311-cp311-win32.whl (47.8 kB view details)

Uploaded CPython 3.11 Windows x86

libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_x86_64.whl (606.2 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_i686.whl (661.8 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_aarch64.whl (586.7 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (86.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (75.3 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

libstreamvbyte-0.2.1-cp311-cp311-macosx_10_9_universal2.whl (105.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

libstreamvbyte-0.2.1-cp310-cp310-win_amd64.whl (60.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

libstreamvbyte-0.2.1-cp310-cp310-win32.whl (47.8 kB view details)

Uploaded CPython 3.10 Windows x86

libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_x86_64.whl (606.2 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_i686.whl (661.8 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_aarch64.whl (586.7 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (81.9 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (86.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (75.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

libstreamvbyte-0.2.1-cp310-cp310-macosx_10_9_universal2.whl (105.9 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file libstreamvbyte-0.2.1.tar.gz.

File metadata

  • Download URL: libstreamvbyte-0.2.1.tar.gz
  • Upload date:
  • Size: 761.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for libstreamvbyte-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f7aab4aa7b60ce9be400f2593ecf033ce20d03d5cefec96055f45bae1d2d0bae
MD5 332ed2f1007ba92a9b26c350b7e72491
BLAKE2b-256 8fb4c2ea13b5a50db9d8b862e5f7edd031918ce112eff05e12606dbe82575cab

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4e5aa3d1099e0e00553655a5427434185a8e8a30d95d2088c52222a56715c5b3
MD5 d6b70c438b653baef1daf955593e9a22
BLAKE2b-256 8bd4115bf26528283e823de13f752b6dda60e98cb994dd5c80d6d4d4003898d3

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 017e6635d8f72ac1127b7dcc04640fc172020a376e76ae2318e898852090a471
MD5 3e8e209f8d72b14ccc1a065a150b64a0
BLAKE2b-256 e5a0a00fb226d762e3d00497b2b239de016964f6db76516846afe0d42f04bc5a

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 7072ea2146ba555a6468bb38ca7d1a3a27db6e733ed01ecb38714ec984214424
MD5 30f70d9086a48e8df763438e3d8be07d
BLAKE2b-256 35b43ae966d229342905dcad490369752731a7bfa5214d6a24b95493d7059125

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 3f45d7c10a946fe9781d769fd2e83ec26ceadd7763384aabaa631d68c9690143
MD5 f8c7dde51075317842c6e37a663519e6
BLAKE2b-256 7b20e67278ca5cfe424ef98920d43f0f31610ec0dfda1915830ace5fb163f15a

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 7b67f5f82376b0c0e8f7b96a8b929a93b2888c684740fa822c2c3a63670b9a3d
MD5 7805e64ee04241945379f20a8f179f50
BLAKE2b-256 34653bf44940f30f3197a1d2e40974e02be5eb7ab85d9536867e319c7ddd06b2

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 540adc1a247ae50bfc9a0b7191cf5c67b4aa334afc6e4d8ef8905f4563f3ac4e
MD5 38b84f1ba50a19cba373dbe0d16efacc
BLAKE2b-256 d39d1322f1c375fd73eebb196478ff6de1187c8e3f1b9f95d598899adc5a03ed

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 00df597ef5db212033958e28e154264df87add9f7f1133a2c4b5515328abf1c6
MD5 128da37fcb063452139df4bbd44d7cfb
BLAKE2b-256 4434ed1bb0df8c571a91ca72b8ae8bcbfc4a65c279cdb3350902e734f9fcda02

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cf210c5d5b0c9fc7443c3a58d891499be9a28b36c3ce2c767369ce12b86e78cf
MD5 038a0cd9b4a3f65d35f92878be6c907e
BLAKE2b-256 70aff088a1d3077a8b5eda37ff95c7df5debfe5c6618601fc5673bc6289f1764

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bee49546ac957b00f5a56195caba670e386f9b44371ebf7d3ed6ce48236a1760
MD5 bdb7c1e130f3b6e9e7046e821df893c7
BLAKE2b-256 e99b6b9dd89684fb7b0b12f1e56f053ef8579d3970b1427697935317cd8db046

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b59c8b94a0896bd98250b005003f8efe8aaf1693e422efa5ac6a102243e44fa9
MD5 1a59348ee45f1d34b5548a300d8c578e
BLAKE2b-256 16e3e8801fee82898f6600a1ed919c929223cf589695629085ade3c5ba0bec11

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 a05eae96d044b2eeee3ef1dc4b933b1126282bd258891ba2c692c4aa0ebdb375
MD5 8e6c1423af81262a81012a16a0e0edff
BLAKE2b-256 a7e858f40b8f249f9f3d62248f8e212179b6a48dec6a46cc8f3ade5915781881

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3bdb900ab50e7dc8d0a321a467895b18f477457a2b91940ea626db20f5501117
MD5 4539479beeff8875789b3dbb8181824c
BLAKE2b-256 c566fb221890d6dccd4fbd78a350b8c08e94c982d7064b8c003d73e9ad5e538b

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 ae983d0690e56056d457d3cfabaf1475222b2a77474d6cc212813dca2f8f67a6
MD5 c88d955443963a5989b17fc78a07421f
BLAKE2b-256 4dc45bc9c99f719d3cb211b6f5c4733ce1f675f0bd7ba7e29a74ac057d88253b

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 e1f52187dd59226637757fb4d18fcc95e80699d72f2e5d1128feb9f0a7fd5f1f
MD5 4b780d285e87a35784380352d3ba810f
BLAKE2b-256 5a34f6aef5d10cd5fafb4f3e46a099422747f6441ec9e314094605b9016688ae

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a2a7b706777fe55d369f1a47dc481da27bd2d6139b777854536288fa67174b9
MD5 de9592bd13b8b9802e021f78ef841adb
BLAKE2b-256 9c73dfcff200806601713f1c11afbdeb06c79983b61487ca2516bbf588d9531b

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 823ec3f74bba65f29caf181b886cf5b5a7b34c58173e71f484b1aa9134102160
MD5 0a6e287e95dcc54c66386fb5476a6a6e
BLAKE2b-256 1b14744fc1dac06ee868b1d43343419f7caa0c7d31be4cb2f5423152f85221cb

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c23d787c40e675a476d379e15a1f0615e3418f9b50d525e08ffc7ea5a1df15f7
MD5 44dfd91a4cc3a991f4403f21450e30cb
BLAKE2b-256 5a47a2c152dbc192a8601842aa5b91142f29b71d076c58db714c2a46a6cd2ea3

See more details on using hashes here.

File details

Details for the file libstreamvbyte-0.2.1-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for libstreamvbyte-0.2.1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 16e2679560f644bf49071815ae2d8e218d59ea047c3eee42b2f61361d586b7f3
MD5 c74fb2fc290d72284be9536b23fa14c8
BLAKE2b-256 6097fd83632a30c068ad899c8e0b85b8fd586043282ed0d5c4f24026e513db20

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page