fashex - fast hexadecimal encoding and decoding
Hexadecimal string encoding and decoding with best-effort SIMD acceleration.
Highlights
- Best-effort SIMD acceleration.
- Small, focused public APIs.
Performance
This crate is comparable in performance to hex-simd, slightly better than const-hex, and far superior to faster-hex.
For benchmark results, please refer to BENCHMARK.md.
Usage
Adds fashex as a dependency in your Cargo.toml:
[]
= "*" # Please specify the latest version instead of "*"!
For detailed usage instructions, please refer to the documentation.
Features
-
alloc(default)Enables Rust
alloccrate support. -
std(default)Enables Rust standard library support.
-
nightlyEnables features that require nightly Rust.
-
portable-simdEnables portable SIMD acceleration support via unstable
core::simd, which may help improve performance on platforms other thanx86,x86_64,aarch64(arm64ec),loongarch32andloongarch64.Notes: this requires nightly Rust.
-
experimental-loongarch-simdEnables experimental SIMD acceleration via Loongson SIMD eXtention or Loongson Advanced SIMD eXtention.
Notes: this requires nightly Rust.
-
runtime-cpu-detection(default)Enables CPU features detection at runtime.
no_std support
This crate is no_std-friendly, just disable the default features:
[]
= { = "*", = false, = [] } # Please specify the latest version instead of "*"!
Some notes:
- You will probably need to enable "alloc" feature manually.
- OS-independent
no_std-friendly CPU features detection is only supported onx86andx86_64platforms. On other platforms,runtime-cpu-detectiondoes nothing when "std" feature is disabled.
Disclaimer
Although all tests are passing and hours of fuzzing show no failures, latent bugs may still exist in the code.
- The SIMD-accelerated code paths for
x86/x86_64architecture are well tested and fuzzed. - The SIMD-accelerated code paths for
aarch64architecture are tested and fuzzed. - The SIMD-accelerated code paths for
loongarch64/loongarch32architecture are cross-tested, but not extensively fuzzed.
If you find any bugs, please report them.
Acknowledgements
This crate is inspired by the following repositories:
hex-simd, SPDX-License-Identifier: MITconst-hex, SPDX-License-Identifier: MIT OR Apache-2.0faster-hex, SPDX-License-Identifier: MIT OR Apache-2.0