Crates.io | fastpfor |
lib.rs | fastpfor |
version | |
source | src |
created_at | 2024-12-19 14:24:44.372137+00 |
updated_at | 2025-02-27 09:33:11.582591+00 |
description | FastPFOR library written in Rust. |
homepage | |
repository | https://github.com/jjcfrancisco/fastpfor |
max_upload_size | |
id | 1489207 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This is a Rust wrapper for the C++ FastPFor library, as well as a pure Rust re-implementation (work in progress). Supports 32-bit and 64-bit integers, and SIMD-optimized codecs for 128-bit and 256-bit vectors. Based on the Decoding billions of integers per second through vectorization, 2012 paper.
Unless otherwise specified, all codecs support &[u32]
only.
&[u32]
and &[u64]
)&[u32]
and &[u64]
)&[u32]
and &[u64]
)cpp
- C++ implementation (default)rust
- Rust implementation (work in progress, opt-in)use fastpfor::cpp::{Codec32 as _, SimdFastPFor128Codec};
fn main() {
let mut codec = SimdFastPFor128Codec::new();
// Encode
let mut input = vec![1, 2, 3, 4, 5];
let mut output = vec![0; 10]; // must be large enough
let enc_slice = codec.encode32(&input, &mut output).unwrap();
// Decode
let mut decoded = vec![0; 10]; // must be large enough
let dec_slice = codec.decode32(&enc_slice, &mut decoded).unwrap();
assert_eq!(input, dec_slice);
}
When using the Rust implementation, no additional dependencies are required. When using the C++ implementation, you need to have a C++ compiler that supports C++14 and SIMD intrinsics. See FastPFor C++ requirements.
The default GitHub action runner for Linux has all the needed dependencies. For local development, you may need to install the following packages.
# This list may be incomplete
sudo apt-get install build-essential libsimde-dev
To build FastPFor on macOS, you'll need to install SIMDe. Since Homebrew installs packages in /opt/homebrew
(for Apple Silicon), you'll also need to explicitly set the include paths.
# install SIMDe via Homebrew
brew install simde
# Ensure the compiler can find the required headers before building
export CXXFLAGS="-I/opt/homebrew/include"
export CFLAGS="-I/opt/homebrew/include"
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.